Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGPMUUT7

BGPMUUT7.m

Go to the documentation of this file.
BGPMUUT7 ;IHS/MSC/MGH - Find if radiology procuedure is in taxonomy ;13-Apr-2011 16:27;DU
 ;;11.1;IHS CLINICAL REPORTING SYSTEM;**1**;JUN 27, 2011;Build 106
 Q
FIND(DFN,TAX,BDATE,EDATE) ; EP
 N BEGIN,START,END,FIRST,PT,ORDER,IEN,OI,TIEN,CODE,CODSYS,ORDERTE,OIN,ORDTE
 S ORDER=0
 S BEGIN=BDATE+1
 S START=9999999-BDATE,END=9999999-EDATE
 S FIRST=END-1
 S PT=DFN_";DPT("
 F  S FIRST=$O(^OR(100,"AR",PT,FIRST)) Q:FIRST=""!($P(FIRST,".",1)>START)!(+ORDER)  D
 .S IEN="" F  S IEN=$O(^OR(100,"AR",PT,FIRST,IEN)) Q:IEN=""!(+ORDER)  D
 ..S OI=0 S OI=$O(^OR(100,IEN,.1,OI)) Q:OI=""  D
 ...S OIN=$G(^OR(100,IEN,.1,OI,0))
 ...Q:'OIN
 ...S CODE=$P($G(^ORD(101.43,OIN,0)),U,3)
 ...S CODSYS=$P($G(^ORD(101.43,OIN,0)),U,4)
 ...I CODSYS="CPT4" D
 ....S TIEN="" S TIEN=$O(^ATXAX("B",TAX,TIEN)) I 'TIEN S ORDER=0 Q
 ....S ORDER=$$ICD^ATXCHK(CODE,TIEN,1)
 ....S ORDTE=$P($G(^OR(100,IEN,0)),U,7)
 ....I ORDER=1 S ORDER=1_U_ORDTE
 Q ORDER
PSFIND(DFN,TAX,BDATE,EDATE) ;EP
 ;Find a pharmacy order
 N BEGIN,START,END,FIRST,PT,ORDER,IEN,DGTYP,DGRP,MED
 S ORDER=0
 S BEGIN=BDATE+1
 S START=9999999-BDATE,END=9999999-EDATE
 S FIRST=END-1
 S PT=DFN_";DPT("
 F  S FIRST=$O(^OR(100,"AR",PT,FIRST)) Q:FIRST=""!($P(FIRST,".",1)>START)!(+ORDER)  D
 .S IEN="" F  S IEN=$O(^OR(100,"AR",PT,FIRST,IEN)) Q:IEN=""!(+ORDER)  D
 ..S DGRP=$P($G(^OR(100,IEN,0)),U,11)
 ..I DGRP'="" D
 ...S DGTYP=$P($G(^ORD(100.98,DGRP,0)),U,3)
 ...I DGTYP["RX" D
 ....S MED=0
 ....S MED=$$LKP(IEN,TAX)
 ....I +MED S ORDER=1_U_$P(MED,U,2)
 Q ORDER
LKP(IEN,TAX)    ;Lookup the order
 N OI,DRUG,RESULT,I,ZERO
 S RESULT=0
 S I=0 F  S I=$O(^OR(100,IEN,4.5,I)) Q:I=""!(+RESULT)  D
 .S ZERO=$G(^OR(100,IEN,4.5,I,0))
 .I $P(ZERO,U,4)="DRUG" D
 .S DRUG=$P($G(^OR(100,IEN,4.5,I,1)),U,1)
 .S RESULT=$$NDC^BGPMUUT4(DRUG,TAX)
 Q RESULT