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

ACDRLU.m

Go to the documentation of this file.
ACDRLU ;IHS/ADC/EDE/KML - GEN RETR UTILITIES;
 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
 ;
 ;
COMPV(C) ;
 K:$L(C)>14!($L(C)<2)!'(C'?1P.E) C K C
 Q
MCR(P,D) ;is patient medicare eligible on this date
 NEW ACDMIFN,ACDFLG
 S ACDFLG=0
 I '$D(^DPT(P,0)) G MCRX
 I $P(^DPT(P,0),U,19) G MCRX
 I '$D(^AUPNPAT(P,0)) G MCRX
 I '$D(^AUPNMCR(P,11)) G MCRX
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G MCRX
 S ACDMIFN=0 F  S ACDMIFN=$O(^AUPNMCR(P,11,ACDMIFN)) Q:ACDMIFN'=+ACDMIFN  D
 .Q:$P(^AUPNMCR(P,11,ACDMIFN,0),U)>D
 .I $P(^AUPNMCR(P,11,ACDMIFN,0),U,2)]"",$P(^(0),U,2)<D Q
 .S ACDFLG=1
 .Q
MCRX ;
 Q ACDFLG
 ;
MCD(P,D) ;
 NEW ACDMIFN,ACDNIFN,ACDFLG
 S ACDFLG=0
 I '$D(^DPT(P,0)) G MCRX
 I $P(^DPT(P,0),U,19) G MCRX
 I '$D(^AUPNPAT(P,0)) G MCDX
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G MCRX
 S ACDMIFN=0 F  S ACDMIFN=$O(^AUPNMCD("B",P,ACDMIFN)) Q:ACDMIFN'=+ACDMIFN  D
 .Q:'$D(^AUPNMCD(ACDMIFN,11))
 .S ACDNIFN=0 F  S ACDNIFN=$O(^AUPNMCD(ACDMIFN,11,ACDNIFN)) Q:ACDNIFN'=+ACDNIFN  D
 ..Q:ACDNIFN>D
 ..I $P(^AUPNMCD(ACDMIFN,11,ACDNIFN,0),U,2)]"",$P(^(0),U,2)<D Q
 ..S ACDFLG=1
 ..Q
 .Q
 ;
MCDX ;
 Q ACDFLG
 ;
PI(P,D) ;
 NEW ACDMIFN,ACDFLG
 S ACDFLG=0
 I '$D(^DPT(P,0)) G PIX
 I $P(^DPT(P,0),U,19) G PIX
 I '$D(^AUPNPAT(P,0)) G PIX
 I '$D(^AUPNPRVT(P,11)) G PIX
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G PIX
 S ACDMIFN=0 F  S ACDMIFN=$O(^AUPNPRVT(P,11,ACDMIFN)) Q:ACDMIFN'=+ACDMIFN  D
 .Q:$P(^AUPNPRVT(P,11,ACDMIFN,0),U)=""
 .S ACDNAME=$P(^AUPNPRVT(P,11,ACDMIFN,0),U) Q:ACDNAME=""
 .Q:$P(^AUTNINS(ACDNAME,0),U)["AHCCCS"
 .Q:$P(^AUPNPRVT(P,11,ACDMIFN,0),U,6)>D
 .I $P(^AUPNPRVT(P,11,ACDMIFN,0),U,7)]"",$P(^(0),U,7)<D Q
 .S ACDFLG=1
 .Q
PIX ;
 Q ACDFLG
ANYINS(P,D) ;EP - return 1 or 0 if patient has any insurance
 NEW ACDA
 S ACDA=0
 S ACDA=$$MCR(P,D) I ACDA Q ACDA
 S ACDA=$$MCD(P,D) I ACDA Q ACDA
 S ACDA=$$PI(P,D)
 Q ACDA
 ;
 Q