source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSS50P7.m@ 842

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

initial load of WorldVistAEHR

File size: 9.4 KB
Line 
1PSS50P7 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.7; 5 Sep 03
2 ;;1.0;PHARMACY DATA MANAGEMENT;**85,91**;9/30/97
3 ;
4ZERO(PSSIEN,PSSFT,PSSFL,LIST) ;
5 ;PSSIEN - IEN of entry in PHARMACY ORDERABLE ITEM file (#50.7).
6 ;PSSFT - Free Text name in PHARMACY ORDERABLE ITEM file (#50.7).
7 ;PSSFL - Inactive flag - "" - All entries.
8 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
9 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
10 ;Field Number of the data piece being returned.
11 ;Returns NAME field (#.01), DOSAGE FORM field (#.02), IV FLAG field (#.03), INACTIVE DATE field (#.04),
12 ;DAY (nD) OR DOSE (nL) LIMIT field (#.05), MED ROUTE field (#.06), SCHEDULE TYPE fiedl (#.07),
13 ;SCHEDULE field (#.08), SUPPLY field (#.09), FORMULARY STATUS field (#5), and NON-VA MED field (#8) of
14 ;PHARMACY ORDERABLE ITEM file (#50.7).
15 N DIERR,ZZERR,PSS50P7,SCR,PSS
16 I $G(LIST)']"" Q
17 K ^TMP($J,LIST)
18 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
19 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
20 S SCR("S")=""
21 I +$G(PSSFL)>0 N ND D SETSCRN
22 I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50.7,"","A","`"_PSSIEN,,SCR("S"),"") D
23 .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
24 .S ^TMP($J,LIST,0)=1
25 .D GETS^DIQ(50.7,+PSSIEN2,".01;.02;.03;.04;.05;.06;.07;.08;.09;8;5","IE","PSS50P7") S PSS(1)=0
26 .F S PSS(1)=$O(PSS50P7(50.7,PSS(1))) Q:'PSS(1) D SETZRO^PSS50P7A
27 I +$G(PSSIEN)'>0,$G(PSSFT)]"" D
28 .I PSSFT["??" D LOOP^PSS50P7A(1) Q
29 .D FIND^DIC(50.7,,"@;.01;.02","QP",PSSFT,,"B",SCR("S"),,"")
30 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
31 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
32 ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K PSS50P7 D GETS^DIQ(50.7,+PSSIEN,".01;.02;.03;.04;.05;.06;.07;.08;.09;8;5","IE","PSS50P7") S PSS(1)=0
33 ..F S PSS(1)=$O(PSS50P7(50.7,PSS(1))) Q:'PSS(1) D SETZRO^PSS50P7A
34 K ^TMP("DILIST",$J)
35 Q
36 ;
37SYNONYM(PSSIEN,PSSFT,PSSFL,LIST) ;
38 ;PSSIEN - IEN of entry in PHARMACY ORDERABLE ITEM file (#50.7).
39 ;PSSFT - Free Text name in PHARMACY ORDERABLE ITEM file (#50.7).
40 ;PSSFL - Inactive flag - 0 or "" - All entries.
41 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
42 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
43 ;Field Number of the data piece being returned.
44 ;Returns NAME field (#.01), DOSAGE FORM field (#.02), SYNONYM subfile (#50.72), and SYNONYM field (#.01)
45 ;of PHARMACY ORDERABLE ITEM file (#50.7).
46 N DIERR,ZZERR,PSS50P7,SCR,PSS,CNT
47 I $G(LIST)']"" Q
48 K ^TMP($J,LIST)
49 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
50 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
51 S SCR("S")=""
52 I +$G(PSSFL)>0 N ND D SETSCRN
53 I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50.7,"","A","`"_PSSIEN,,SCR("S"),"") D
54 .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
55 .S ^TMP($J,LIST,0)=1
56 .D GETS^DIQ(50.7,+PSSIEN2,".01;.02;2*","IE","PSS50P7") S PSS(1)=0
57 .S CNT=0 F S PSS(1)=$O(PSS50P7(50.72,PSS(1))) Q:'PSS(1) D SETSYN^PSS50P7A S CNT=CNT+1
58 .S ^TMP($J,LIST,+PSSIEN2,"SYN",0)=$S(CNT>0:CNT,1:"-1^NO DATA FOUND")
59 .S PSS(2)=0 F S PSS(2)=$O(PSS50P7(50.7,PSS(2))) Q:'PSS(2) D SETZR2^PSS50P7A
60 I +$G(PSSIEN)'>0,$G(PSSFT)]"" D
61 .I PSSFT["??" D LOOP^PSS50P7A(2) Q
62 .D FIND^DIC(50.7,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
63 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
64 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
65 ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K PSS50P7(50.72) K PSS50P7 D GETS^DIQ(50.7,+PSSIEN,".01;.02;2*","IE","PSS50P7") S PSS(1)=0
66 ..S CNT=0 F S PSS(1)=$O(PSS50P7(50.72,PSS(1))) Q:'PSS(1) D SETSYN^PSS50P7A S CNT=CNT+1
67 ..S ^TMP($J,LIST,+PSSIEN,"SYN",0)=$S(CNT>0:CNT,1:"-1^NO DATA FOUND")
68 ..S PSS(2)=0 F S PSS(2)=$O(PSS50P7(50.7,PSS(2))) Q:'PSS(2) D SETZR2^PSS50P7A
69 K ^TMP("DILIST",$J)
70 Q
71 ;
72NAME(PSSIEN) ;
73 ;PSSIEN - IEN of entry in PHARMACY ORDERABLE ITEM file (#50.7).
74 ;Returns NAME field (#.01) of PHARMACY ORDERABLE ITEM file (#50.7) and DOSAGE FORM name in external form.
75 N DIERR,ZZERR,PSS50P7,PSS
76 I +$G(PSSIEN)'>0 Q ""
77 D GETS^DIQ(50.7,+PSSIEN,".01;.02","E","PSS50P7")
78 I '$D(PSS50P7) Q ""
79 Q $G(PSS50P7(50.7,PSSIEN_",",.01,"E"))_" "_$G(PSS50P7(50.7,PSSIEN_",",.02,"E"))
80 ;
81INSTR(PSSIEN,PSSFT,PSSFL,LIST) ;
82 ;PSSIEN - IEN of entry in PHARMACY ORDERABLE ITEM file (#50.7).
83 ;PSSFT - Free Text name in PHARMACY ORDERABLE ITEM file (#50.7).
84 ;PSSFL - Inactive flag - "" - All entries.
85 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
86 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
87 ;Field Number of the data piece being returned.
88 ;Returns INS and INS1 nodes of PHARMACY ORDERABLE ITEM file (#50.7).
89 N DIERR,ZZERR,PSS50P7,SCR,PSS
90 I $G(LIST)']"" Q
91 K ^TMP($J,LIST)
92 I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
93 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
94 S SCR("S")=""
95 I +$G(PSSFL)>0 N ND D SETSCRN
96 I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50.7,"","A","`"_PSSIEN,,SCR("S"),"") D
97 .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
98 .S ^TMP($J,LIST,0)=1
99 .D GETS^DIQ(50.7,+PSSIEN2,".01;.02;7;7.1","IE","PSS50P7") S PSS(1)=0
100 .F S PSS(1)=$O(PSS50P7(50.7,PSS(1))) Q:'PSS(1) D SETPTI^PSS50P7A
101 I +$G(PSSIEN)'>0,$G(PSSFT)]"" D
102 .I PSSFT["??" D LOOP^PSS50P7A(3) Q
103 .D FIND^DIC(50.7,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
104 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
105 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
106 ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K PSS50P7 D GETS^DIQ(50.7,+PSSIEN,".01;.02;7;7.1","IE","PSS50P7") S PSS(1)=0
107 ..F S PSS(1)=$O(PSS50P7(50.7,PSS(1))) Q:'PSS(1) D SETPTI^PSS50P7A
108 K ^TMP("DILIST",$J)
109 Q
110 ;
111DRGIEN(PSSIEN,PSSFL,LIST) ;
112 ;PSSIEN - IEN of entry in PHARMACY ORDERABLE ITEM file (#50.7).
113 ;PSSFL - Inactive flag - "" - All entries.
114 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
115 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
116 ;Field Number of the data piece being returned.
117 ;Returns entries from DRUG file (#50) linked to the Pharmacy Orderable Item IEN passed, GENERIC NAME field (#.01),
118 ;DEA, SPECIAL HDLG field (#3), APPLICATION PACKAGES' USE field (#63), and the INACTIVE DATE field (#100)
119 ;of DRUG file (#50).
120 N DIERR,ZZERR,PSS50P7,SCR,PSS
121 I $G(LIST)']"" Q
122 K ^TMP($J,LIST)
123 I +$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
124 S SCR("S")="I +Y'=$G(PSSIEN)"
125 ;Naked reference below refers to ^PSDRUG(+Y,"I")
126 I +$G(PSSFL)>0 S SCR("S")="S ND=$G(^(""I"")) I ((ND="""")&(+Y'=$G(PSSIEN)))!((ND>PSSFL)&(+Y'=$G(PSSIEN)))"
127 I +$G(PSSIEN)>0 D FIND^DIC(50,,"@;.01","QX",PSSIEN,,"ASP",SCR("S"),,"PSS50P7")
128 I +PSS50P7("DILIST",0)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
129 S ^TMP($J,LIST,0)=+PSS50P7("DILIST",0) S PSS(1)=0 D
130 .F S PSS(1)=$O(PSS50P7("DILIST",PSS(1))) Q:'PSS(1) S PSS(2)=0 F S PSS(2)=$O(PSS50P7("DILIST",PSS(1),PSS(2))) Q:'PSS(2) S ^TMP($J,LIST,+PSS50P7("DILIST",PSS(1),PSS(2)))=""
131 Q
132 ;
133IEN(PSSFT,PSSFL,LIST) ;
134 ;PSSFT - Free Text name in PHARMACY ORDERABLE ITEM file (#50.7).
135 ;PSSFL - Inactive flag - "" - All entries.
136 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
137 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
138 ;Field Number of the data piece being returned.
139 ;Returns NAME field (#.01), and DOSAGE FORM field (#.02) of PHARMACY ORDERABLE ITEM file (#50.7).
140 N DIERR,ZZERR,PSS50P7,SCR,PSS
141 I $G(LIST)']"" Q
142 K ^TMP($J,LIST)
143 I $G(PSSFT)']"" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
144 S SCR("S")=""
145 I +$G(PSSFL)>0 D SETSCRN
146 I PSSFT["??" D LOOP^PSS50P7A(4) Q
147 I $G(PSSFT)]"" D FIND^DIC(50.7,,"@;.01;.02IE","QP",PSSFT,,"B",SCR("S"),,"")
148 I +$G(^TMP("DILIST",$J,0))'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
149 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) S PSS(2)=0 D
150 .F S PSS(2)=$O(^TMP("DILIST",$J,PSS(2))) Q:'PSS(2) D
151 ..S ^TMP($J,LIST,+^TMP("DILIST",$J,PSS(2),0),.01)=$P(^TMP("DILIST",$J,PSS(2),0),"^",2)
152 ..S ^TMP($J,LIST,"B",$P(^TMP("DILIST",$J,PSS(2),0),"^",2),+^TMP("DILIST",$J,PSS(2),0))=""
153 ..S ^TMP($J,LIST,+^TMP("DILIST",$J,PSS(2),0),.02)=$S($P($G(^TMP("DILIST",$J,PSS(2),0)),"^",3)]"":$P(^TMP("DILIST",$J,PSS(2),0),"^",3,4),1:"")
154 K ^TMP("DILIST",$J)
155 Q
156 ;
157LOOKUP(PSSFT,PSSD,PSSS,LIST) ;
158 ;PSSFT - Free Text name in PHARMACY ORDERABLE ITEM file (#50.7)
159 ;PSSD - Index being traversed.
160 ;PSSS - Screening information as defined in DIC("S").
161 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the
162 ;Field Number of the data piece being returned.
163 ;Returns NAME field (#.01), DOSAGE FORM field (#.02), and INACTIVE DATE field (#.04) of
164 ;PHARMACY ORDERABLE ITEM file (#50.7).
165 N DIERR,ZZERR,PSS50P7,SCR,PSS
166 I $G(LIST)']"" Q
167 K ^TMP($J,LIST)
168 I $G(PSSFT)']"" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
169 D LOOKUP^PSS50P7A
170 Q
171 ;
172SETSCRN ;Set Screen for inactive entries in PHARMACY ORDERABLE ITEM file (#50.7).
173 ;Naked reference below refers to ^PS(50.7,+Y,0)
174 S SCR("S")="S ND=$P($G(^(0)),U,4) I ND=""""!(ND>PSSFL)"
175 Q
Note: See TracBrowser for help on using the repository browser.