[613] | 1 | PSS50C ;BIR/LDT - API FOR INFORMATION FROM FILE 50; 5 Sep 03
|
---|
| 2 | ;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
|
---|
| 3 | ;
|
---|
| 4 | WS ;
|
---|
| 5 | ;PSSIEN - IEN of entry in 50
|
---|
| 6 | ;PSSFT - Free Text name in 50
|
---|
| 7 | ;PSSFL - Inactive flag - "" - All entries
|
---|
| 8 | ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
|
---|
| 9 | ;PSSPK - Application Package's Use - "" - All entries
|
---|
| 10 | ; Alphabetic codes that represent the DHCP packages that consider this drug to be
|
---|
| 11 | ; part of their formulary.
|
---|
| 12 | ;PSSRTOI - Orderable Item - return only entries matched to a Pharmacy Orderable Item
|
---|
| 13 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 14 | ; piece being returned.
|
---|
| 15 | ;Returns PSG node of 50
|
---|
| 16 | N DIERR,ZZERR,PSSP50,SCR,PSS,PSSMLCT
|
---|
| 17 | I $G(LIST)']"" Q
|
---|
| 18 | K ^TMP($J,LIST)
|
---|
| 19 | I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 20 | S SCR("S")=""
|
---|
| 21 | I +$G(PSSFL)>0!($G(PSSPK)]"")!($G(PSSRTOI)=1) N PSS5ND,PSSZ3,PSSZ4 D SETSCRN^PSS50A
|
---|
| 22 | I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50,"","A","`"_PSSIEN,,SCR("S"),"") D K ^TMP("PSSP50",$J) Q
|
---|
| 23 | .K ^TMP("DIERR",$J)
|
---|
| 24 | .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 25 | .S ^TMP($J,LIST,0)=1
|
---|
| 26 | .K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN2,".01;300:302","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 27 | .F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETWS^PSS50C1
|
---|
| 28 | I $G(PSSIEN)'="" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 29 | I $G(PSSFT)]"" D
|
---|
| 30 | .I PSSFT["??" D LOOP^PSS50C1 Q
|
---|
| 31 | .K ^TMP("DILIST",$J)
|
---|
| 32 | .D FIND^DIC(50,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
|
---|
| 33 | .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 34 | .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
|
---|
| 35 | ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0)
|
---|
| 36 | ..K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN,".01;300:302","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 37 | ..F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETWS^PSS50C1
|
---|
| 38 | K ^TMP("DILIST",$J),^TMP("PSSP50",$J)
|
---|
| 39 | Q
|
---|
| 40 | ;
|
---|
| 41 | MRTN ;
|
---|
| 42 | ;PSSIEN - IEN of entry in 50
|
---|
| 43 | ;PSSFT - Free Text name in 50
|
---|
| 44 | ;PSSFL - Inactive flag - "" - All entries
|
---|
| 45 | ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
|
---|
| 46 | ;PSSPK - Application Package's Use - "" - All entries
|
---|
| 47 | ; Alphabetic codes that represent the DHCP packages that consider this drug to be
|
---|
| 48 | ; part of their formulary.
|
---|
| 49 | ;PSSRTOI - Orderable Item - return only entries matched to a Pharmacy Orderable Item
|
---|
| 50 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 51 | ; piece being returned.
|
---|
| 52 | ;Returns GENERIC NAME (#.01),LAB TEST MONITOR (#17.2),MONITOR ROUTINE (#17.5), and NDC (#31)
|
---|
| 53 | N DIERR,ZZERR,PSSP50,SCR,PSS,PSSMLCT
|
---|
| 54 | I $G(LIST)']"" Q
|
---|
| 55 | K ^TMP($J,LIST)
|
---|
| 56 | I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 57 | S SCR("S")=""
|
---|
| 58 | I +$G(PSSFL)>0!($G(PSSPK)]"")!($G(PSSRTOI)=1) N PSS5ND,PSSZ3,PSSZ4 D SETSCRN^PSS50A
|
---|
| 59 | I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50,"","A","`"_PSSIEN,,SCR("S"),"") D K ^TMP("PSSP50",$J) Q
|
---|
| 60 | .K ^TMP("DIERR",$J)
|
---|
| 61 | .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 62 | .S ^TMP($J,LIST,0)=1
|
---|
| 63 | .K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN2,".01;17.2;17.5;31","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 64 | .F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETMRTN^PSS50C1
|
---|
| 65 | I $G(PSSIEN)'="" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 66 | I $G(PSSFT)]"" D
|
---|
| 67 | .I PSSFT["??" D LOOPMR^PSS50C1 Q
|
---|
| 68 | .K ^TMP("DILIST",$J)
|
---|
| 69 | .D FIND^DIC(50,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
|
---|
| 70 | .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 71 | .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
|
---|
| 72 | ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0)
|
---|
| 73 | ..K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN,".01;17.2;17.5;31","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 74 | ..F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETMRTN^PSS50C1
|
---|
| 75 | K ^TMP("DILIST",$J),^TMP("PSSP50",$J)
|
---|
| 76 | Q
|
---|
| 77 | ;
|
---|
| 78 | ZERO ;
|
---|
| 79 | ;PSSIEN - IEN of entry in 50
|
---|
| 80 | ;PSSFT - Free Text name in 50
|
---|
| 81 | ;PSSFL - Inactive flag - "" - All entries
|
---|
| 82 | ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
|
---|
| 83 | ;PSSPK - Application Package's Use - "" - All entries
|
---|
| 84 | ; Alphabetic codes that represent the DHCP packages that consider this drug to be
|
---|
| 85 | ; part of their formulary.
|
---|
| 86 | ;PSSRTOI - Orderable Item - return only entries matched to a Pharmacy Orderable Item
|
---|
| 87 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 88 | ; piece being returned.
|
---|
| 89 | ;Returns zero node of 50
|
---|
| 90 | N DIERR,ZZERR,PSSP50,SCR,PSS,PSSMLCT
|
---|
| 91 | I $G(LIST)']"" Q
|
---|
| 92 | K ^TMP($J,LIST)
|
---|
| 93 | I +$G(PSSIEN)'>0,($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 94 | S SCR("S")=""
|
---|
| 95 | I +$G(PSSFL)>0!($G(PSSPK)]"")!($G(PSSRTOI)=1) N PSS5ND,PSSZ3,PSSZ4 D SETSCRN^PSS50A
|
---|
| 96 | I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50,"","A","`"_PSSIEN,,SCR("S"),"") D K ^TMP("PSSP50",$J) Q
|
---|
| 97 | .K ^TMP("DIERR",$J)
|
---|
| 98 | .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 99 | .S ^TMP($J,LIST,0)=1
|
---|
| 100 | .K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN2,".01;2:8;51:52;101","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 101 | .F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETZRO^PSS50C1
|
---|
| 102 | I $G(PSSIEN)'="" S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 103 | I $G(PSSFT)]"" D
|
---|
| 104 | .I PSSFT["??" D LOOPZR^PSS50C1 Q
|
---|
| 105 | .K ^TMP("DILIST",$J)
|
---|
| 106 | .D FIND^DIC(50,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
|
---|
| 107 | .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 108 | .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
|
---|
| 109 | ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0)
|
---|
| 110 | ..K ^TMP("PSSP50",$J) D GETS^DIQ(50,+PSSIEN,".01;2:8;51:52;101","IE","^TMP(""PSSP50"",$J)") S PSS(1)=0
|
---|
| 111 | ..F S PSS(1)=$O(^TMP("PSSP50",$J,50,PSS(1))) Q:'PSS(1) D SETZRO^PSS50C1
|
---|
| 112 | K ^TMP("DILIST",$J),^TMP("PSSP50",$J)
|
---|
| 113 | Q
|
---|
| 114 | ;
|
---|
| 115 | NOCMOP(PSSIEN2,PSSFL2) ;
|
---|
| 116 | ;PSSIEN - IEN of entry in 50
|
---|
| 117 | ;PSSFL - 1 check ^PSDRUG(D0,3)=1
|
---|
| 118 | ; 0 or "" check ^PSDRUG(D0,3)=0 or ""
|
---|
| 119 | I +$G(PSSIEN2)'>0 Q 0
|
---|
| 120 | N NDNODE,INODE,NODE2,NODE3,ZNODE
|
---|
| 121 | S NDNODE=$G(^PSDRUG(+PSSIEN2,"ND")),INODE=$G(^("I")),NODE3=$G(^(3)),NODE2=$G(^(2)),ZNODE=$G(^(0))
|
---|
| 122 | I $P(NODE2,"^",3)["O",$P(NDNODE,"^",2)]"",INODE="",$S($G(PSSFL2)=1:NODE3=0,1:'$D(^PSDRUG(+PSSIEN2,3))) Q 1
|
---|
| 123 | Q 0
|
---|
| 124 | ;
|
---|
| 125 | MSG ;
|
---|
| 126 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 127 | ; piece being returned.
|
---|
| 128 | I $G(LIST)']"" Q
|
---|
| 129 | K ^TMP($J,LIST)
|
---|
| 130 | N ZNODE,NODE5,INODE
|
---|
| 131 | S ^TMP($J,LIST,0)=0
|
---|
| 132 | S PSS(1)=0 F S PSS(1)=$O(^PSDRUG(PSS(1))) Q:'PSS(1) D
|
---|
| 133 | .S ZNODE=$G(^PSDRUG(+PSS(1),0)),NODE5=$G(^(5)),INODE=$G(^("I"))
|
---|
| 134 | .I NODE5]"" S ^TMP($J,LIST,0)=^TMP($J,LIST,0)+1,^TMP($J,LIST,+PSS(1),.01)=$P(ZNODE,"^") D
|
---|
| 135 | ..S ^TMP($J,LIST,"B",$P(ZNODE,"^"),+PSS(1))=""
|
---|
| 136 | ..I INODE]"" S Y=INODE D DD^%DT S INODE=INODE_"^"_Y
|
---|
| 137 | ..S ^TMP($J,LIST,+PSS(1),100)=INODE
|
---|
| 138 | Q
|
---|
| 139 | ;
|
---|
| 140 | IEN ;
|
---|
| 141 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 142 | ; piece being returned.
|
---|
| 143 | I $G(LIST)']"" Q
|
---|
| 144 | K ^TMP($J,LIST)
|
---|
| 145 | N NDNODE,INODE,ZNODE
|
---|
| 146 | S ^TMP($J,LIST,0)=0
|
---|
| 147 | S PSS(1)="" F S PSS(1)=$O(^PSDRUG("IU",PSS(1))) Q:PSS(1)="" D
|
---|
| 148 | .Q:PSS(1)'["O" S PSS(2)=0 F S PSS(2)=$O(^PSDRUG("IU",PSS(1),PSS(2))) Q:'PSS(2) D
|
---|
| 149 | ..S NDNODE=$G(^PSDRUG(PSS(2),"ND")),INODE=$G(^("I")),ZNODE=$G(^(0))
|
---|
| 150 | ..I $P(NDNODE,"^",2)]"",INODE="" D
|
---|
| 151 | ...S ^TMP($J,LIST,0)=^TMP($J,LIST,0)+1,^TMP($J,LIST,+PSS(2),.01)=$P(ZNODE,"^")
|
---|
| 152 | ...S ^TMP($J,LIST,"IU",$P(ZNODE,"^"),+PSS(2))=""
|
---|
| 153 | Q
|
---|
| 154 | ;
|
---|
| 155 | AB ;
|
---|
| 156 | ;PSSVAL - ITEM NUMBER sub-field (#.01) of the IFCAP ITEM NUMBER multiple of the DRUG file (#50)
|
---|
| 157 | ;PSSFL - Inactive flag - "" - All entries
|
---|
| 158 | ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
|
---|
| 159 | ;PSSPK - Application Package's Use - "" - All entries
|
---|
| 160 | ; Alphabetic codes that represent the DHCP packages that consider this drug to be
|
---|
| 161 | ; part of their formulary.
|
---|
| 162 | ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where Field Number is the Field Number of the data
|
---|
| 163 | ; piece being returned.
|
---|
| 164 | ;Returns zero node of 50
|
---|
| 165 | I $G(LIST)']"" Q
|
---|
| 166 | K ^TMP($J,LIST)
|
---|
| 167 | I +$G(PSSVAL)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
|
---|
| 168 | N PSS,CNT,PSSIEN S (CNT,PSS)=0 F S PSS=$O(^PSDRUG("AB",+PSSVAL,PSS)) Q:'PSS D
|
---|
| 169 | .N INODE,NODE2 S NODE2=$G(^PSDRUG(+PSS,2)),INODE=$G(^("I"))
|
---|
| 170 | .I +$G(PSSFL)>0,+INODE>0,+INODE'>PSSFL Q
|
---|
| 171 | .I $G(PSSPK)]"" N PSSZ5,PSSZ6 S PSSZ5=0 F PSSZ6=1:1:$L(PSSPK) Q:PSSZ5 I $P($G(^(2)),"^",3)[$E(PSSPK,PSSZ6) S PSSZ5=1
|
---|
| 172 | .I $G(PSSPK)]"",'PSSZ5 Q
|
---|
| 173 | .K ^TMP($J,"PSS50") D GETS^DIQ(50,+PSS,".01;441*","IE","^TMP($J,""PSS50""") D
|
---|
| 174 | ..S PSS(1)=0 F S PSS(1)=$O(^TMP($J,"PSS50",50,PSS(1))) Q:'PSS(1) D
|
---|
| 175 | ...S ^TMP($J,LIST,+PSS(1),.01)=$G(^TMP($J,"PSS50",50,PSS(1),.01,"I")),CNT=CNT+1
|
---|
| 176 | ...S ^TMP($J,LIST,"AB",$G(^TMP($J,"PSS50",50,PSS(1),.01,"I")),+PSS(1))="",PSSIEN=+PSS(1)
|
---|
| 177 | ..S (CNT(1),PSS(2))=0 F S PSS(2)=$O(^TMP($J,"PSS50",50.0441,PSS(2))) Q:'PSS(2) D
|
---|
| 178 | ...S ^TMP($J,LIST,+PSSIEN,"IFC",+PSS(2),.01)=$G(^TMP($J,"PSS50",50.0441,PSS(2),.01,"I")),CNT(1)=CNT(1)+1
|
---|
| 179 | ..S ^TMP($J,LIST,+PSSIEN,"IFC",0)=$S(CNT(1)>0:CNT(1),1:"-1^NO DATA FOUND")
|
---|
| 180 | S ^TMP($J,LIST,0)=$S(CNT>0:CNT,1:"-1^NO DATA FOUND")
|
---|
| 181 | K ^TMP($J,"PSS50")
|
---|
| 182 | Q
|
---|