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

AGBIC2C.m

Go to the documentation of this file.
AGBIC2C ; IHS/ASDS/EFG - COMPUTE ELIGIBILITY STATUS ;  
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
 Q:'$D(^AUPNPAT(DFN,11))
 S AG("OLDELIG")=" "
 I $P(^AUPNPAT(DFN,11),U,24)]"" D
 . S AG("OLDELIG")=$P(^AUTTBICE($P(^AUPNPAT(DFN,11),U,24),0),U,2)
 S AG("Q")=$P(^AUPNPAT(DFN,11),U,10)
 S AG("TRIBE")=$P(^AUPNPAT(DFN,11),U,8)
 S AG("MINOR")=$P(^AUPNPAT(DFN,11),U,25)
 S AG("TRBVER")=$P(^AUPNPAT(DFN,11),U,19)
 S AG("BIC")=$P(^AUPNPAT(DFN,11),U,24)
 S AG("RESVER")=$P(^AUPNPAT(DFN,11),U,21)
 S AG("PRVRES")=$P(^AUPNPAT(DFN,11),U,22)
BLOOD ;
 ;Indian using Blood Quantum.
 S AG("Q")=$S(AG("Q")="N":1,AG("Q")="NONE":2,AG("Q")="UNK":3,AG("Q")="UNKNOWN":4,AG("Q")="UNS":5,AG("Q")="UNSPECIFIED":6,1:9)
 G:AG("Q")=9 TRIBE
 S AG("ELIG")="E"
 D SETELIG
 G END
TRIBE ;
 ;Tribal Member.
 I AG("TRIBE")="" I AG("MINOR")'="T"&(AG("MINOR")'="B") D  Q
 . S AG("ELIG")="F"
 . D SETELIG
 . D END
 I AG("TRIBE")]"" S AG("CD")=$P(^AUTTTRI(AG("TRIBE"),0),U,2) I AG("CD")="000"!(AG("CD")>"979") I AG("MINOR")'="T"&(AG("MINOR")'="B") S AG("ELIG")="F" D SETELIG,END Q
 I $P(^AUTTTRI(AG("TRIBE"),0),U,4)="Y" I AG("MINOR")'="T"&(AG("MINOR")'="B") D  Q
 . S AG("ELIG")="F"
 . D SETELIG
 . D END
TRBVER ;
 I AG("TRBVER")'="Y"&(AG("MINOR")'="T")&(AG("MINOR")'="B") G TRBNOTVR
RES ;
 ;Resides in HSDA.
 I '$D(^AUPNPAT(DFN,51)) G CKPREV
 S AG("DT")=0
 S AG("DT")=$O(^AUPNPAT(DFN,51,AG("DT")))
 I $P(^AUPNPAT(DFN,51,AG("DT"),0),U,3)="" G CKPREV
 I $P(^AUTTCTY($P(^AUTTCOM($P(^AUPNPAT(DFN,51,AG("DT"),0),U,3),0),U,2),0),U,5)'="Y" G CKPARENT
RESVER ;
 ;Residence Verified.
 I AG("RESVER")="Y"!(AG("MINOR")="C")!(AG("MINOR")="B") D  Q
 . S AG("ELIG")="A"
 . D SETELIG
 . D END
RESNOTVR ;
 S AG("ELIG")="G"
 D SETELIG
 D END
 Q
CKPARENT ;
 I AG("MINOR")="C"!(AG("MINOR")="B") D  Q
 . S AG("ELIG")="A"
 . D SETELIG
 . D END
CKPREV ;
 I AG("MINOR")="C"!(AG("MINOR")="B") D  Q
 . S AG("ELIG")="A"
 . D SETELIG
 . D END
 I AG("PRVRES")="Y" D  Q
 . S AG("ELIG")="B"
 . D SETELIG
 . D END
 S AG("ELIG")="X"
 D SETELIG
 D END
 Q
TRBNOTVR ;
 G CKPREV1:'$D(^AUPNPAT(DFN,51))
 G CKPREV1:$P(^AUPNPAT(DFN,51,0),U,3)=""
 G CKPREV1:'$D(^AUPNPAT(DFN,51,$P(^AUPNPAT(DFN,51,0),U,3),0))
 S AG("DT")=0
 S AG("DT")=$O(^AUPNPAT(DFN,51,AG("DT")))
 I $P(^AUPNPAT(DFN,51,AG("DT"),0),U,3)="" G CKPREV1
 I $P(^AUTTCTY($P(^AUTTCOM($P(^AUPNPAT(DFN,51,AG("DT"),0),U,3),0),U,2),0),U,5)'="Y" G CKPRNT1
 I AG("RESVER")="Y"!(AG("MINOR")="C")!(AG("MINOR")="B") S AG("ELIG")="Z" D SETELIG,END Q
 S AG("ELIG")="K"
 D SETELIG
 D END
 Q
CKPRNT1 ;
 I AG("MINOR")="C"!(AG("MINOR")="B") D  Q
 . S AG("ELIG")="Z"
 . D SETELIG
 . D END
CKPREV1 ;
 I AG("MINOR")="C"!(AG("MINOR")="B") D  Q
 . S AG("ELIG")="Z"
 . D SETELIG
 . D END
 I AG("PRVRES")="Y" D  Q
 . S AG("ELIG")="J"
 . D SETELIG
 . D END
 S AG("ELIG")="X"
 D SETELIG
 D END
 Q
END ;
 K AG("COMM"),AG("DT"),AG("ELIG"),AG("OLDELIG"),AG("Q"),AG("TRIBE")
 K AG("MINOR"),AG("TRBVER"),AG("BIC"),AG("RESVER"),AG("PRVRES")
 Q
ELIGDATE ;
 S DA=DFN
 S DR="1123///"_DT
 S DIE="^AUPNPAT("
 D ^DIE
 Q
SETELIG ;
 S DA=DFN
 S DIE="^AUPNPAT("
 S DR="1124///"_AG("ELIG")
 D ^DIE
 D ELIGDATE
 I "AB"[AG("ELIG") I "AB"'[AG("OLDELIG") D ^AGBIC1
 Q