BMEMED0 ; IHS/PHXAO/TMJ - STUFF NO MATCH ENTRIES INTO MONTHLY TEMP FILE ;
;;1.0T1;MEDICAID ELIGIBILITY DOWNLOAD;;JUN 25, 2003
;
;This Routine is called from BMEMED Routine when
;a NO MATCH Record is hit. This Routine populates the
;Temporary Monthly No Match File ^BMETMED(Global
;This File is utilized to manually compare and automatically update
;Patient Registration
;
;
; -- set up variables for stuff in AHCCCS Medicaid File
SET S BMEREC=^BMEGMED(BMEIFN)
S BMEFNAME=$E(BMEREC,131,140),BMELNAME=$E(BMEREC,108,130)
S BMEFNAME=$P(BMEFNAME," ",1),BMELNAME=$P(BMELNAME," ",1) ;Strip out spaces in both names
S BMEMFULN=BMELNAME_","_BMEFNAME
S BMECITY=$E(BMEREC,286,305),BMESTATE=$E(BMEREC,306,307)
S BMECITY=$P(BMECITY," ",1) S RES=BMECITY_", "_BMESTATE
S BMESEX=$E(BMEREC,142,142),BMEMDOB=$E(BMEREC,143,150),BMEMRATE=$E(BMEREC,355,358)
S BMENUM=$E(BMEREC,18,26),BMECOVTP=$E(BMEREC,106,107),BMERESCE=$E(BMEREC,17,17)
S BMEMZIP=$E(BMEREC,223,227) ;Get Medicaid File Zip code
S BMEMCNTY=$E(BMEREC,91,105) S BMEMCTYN=$P(BMEMCNTY," ",1) ;Strip out spaces
;
;NEED TO GET COUNTY IEN FOR CHECK - THE "B" IS AN IEN ON PTR.
Q:$L(BMEMCTYN)=0 ;Quit if No Medicaid County Name
S BMESCNTY=$O(^BMECTY("C",BMEMCTYN,0)) ;Check to see if AHCCCS County Name is in the (COUNTY SCREEN) File
S BMEMSSN=$E(BMEREC,27,35)
;
I 'BMESCNTY Q ;Quit if Not in County Table
;
DATE ;AHCCCS Dates (Y2K Conversion)
S BMEMEBD=$$EBD ;AHCCCS Payment From Date/Beg
S BMEMEED=$$EED ; AHCCCS Payment From/End
S BMEMDOB=$$DOB ;AHCCCS Date of Birth
S BMEMERD=$$ERD ; Enrollment Date
;Q:"AIAN"'[RACE
Q:BMEMEBD=-1 ;Quit if no AHCCCS Beg Elig Dt in MED File
Q:BMEMEED=-1 ;Quit if no AHCCCS End Elig Dt in MED File
;
D NEW
Q
;
NEW ; -- create new entry in local BME MEDICAID ELIGIBLE (NO MATCH) File-Global ^BMETMED(
;Do not stuff the Medicaid End Elig Dt (EED Variable)
;Only stuff the Mediciad Beg Elig Dt (EEB/ERD Variables)
D ^XBFMK K DIADD,DINUM
S X=BMEMEBD,DIC="^BMETMED(",DIC(0)="L",DLAYGO=90332
;S DIC("DR")=".02////"_BMEFNAME
S DIC("DR")=".02////"_BMEMFULN_";.03////"_BMESEX_";.04///"_BMEMDOB_";.05////"_RES
S DIC("DR")=DIC("DR")_";.06////"_BMENUM_";.08////"_BMECOVTP_";4////"_BMEMRATE
S DIC("DR")=DIC("DR")_";1////"_BMEMSSN_";2////"_BMERESCE_";.09////"_BMEMEED
I BMESSNCK="Y" S DIC("DR")=DIC("DR")_";3///"_BMESSNCK
I BMEMKID="Y" S DIC("DR")=DIC("DR")_";5///"_BMEMKID
D FILE^DICN D ^XBFMK K DIADD,DINUM
Q
;
EED() ; -- eligibility end date
;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
N X,Y S BMEYYYY=$E(BMEREC,412,415),BMEMMDD=$E(BMEREC,416,419)
S BMEMEED=BMEMMDD_BMEYYYY
S X=BMEMEED D ^%DT Q Y
;
EBD() ; -- eligibility begin date
;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
N X,Y S BMEYYYY=$E(BMEREC,347,350),BMEMMDD=$E(BMEREC,351,354)
S BMEMEBD=BMEMMDD_BMEYYYY
S X=BMEMEBD D ^%DT Q Y
;
ERD() ; -- Med Enrollment Dt
;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
N X,Y S BMEYYYY=$E(BMEREC,347,350),BMEMMDD=$E(BMEREC,351,354)
S BMEMERD=BMEMMDD_BMEYYYY
S X=BMEMERD D ^%DT Q Y
;
DOB() ;Date of Birth Conversion
N X,Y S BMEYYYY=$E(BMEMDOB,1,4),BMEMMDD=$E(BMEMDOB,5,8)
S BMEMDOB=BMEMMDD_BMEYYYY
S X=BMEMDOB D ^%DT Q Y
;
BMEMED0 ; IHS/PHXAO/TMJ - STUFF NO MATCH ENTRIES INTO MONTHLY TEMP FILE ;
+1 ;;1.0T1;MEDICAID ELIGIBILITY DOWNLOAD;;JUN 25, 2003
+2 ;
+3 ;This Routine is called from BMEMED Routine when
+4 ;a NO MATCH Record is hit. This Routine populates the
+5 ;Temporary Monthly No Match File ^BMETMED(Global
+6 ;This File is utilized to manually compare and automatically update
+7 ;Patient Registration
+8 ;
+9 ;
+10 ; -- set up variables for stuff in AHCCCS Medicaid File
SET SET BMEREC=^BMEGMED(BMEIFN)
+1 SET BMEFNAME=$EXTRACT(BMEREC,131,140)
SET BMELNAME=$EXTRACT(BMEREC,108,130)
+2 ;Strip out spaces in both names
SET BMEFNAME=$PIECE(BMEFNAME," ",1)
SET BMELNAME=$PIECE(BMELNAME," ",1)
+3 SET BMEMFULN=BMELNAME_","_BMEFNAME
+4 SET BMECITY=$EXTRACT(BMEREC,286,305)
SET BMESTATE=$EXTRACT(BMEREC,306,307)
+5 SET BMECITY=$PIECE(BMECITY," ",1)
SET RES=BMECITY_", "_BMESTATE
+6 SET BMESEX=$EXTRACT(BMEREC,142,142)
SET BMEMDOB=$EXTRACT(BMEREC,143,150)
SET BMEMRATE=$EXTRACT(BMEREC,355,358)
+7 SET BMENUM=$EXTRACT(BMEREC,18,26)
SET BMECOVTP=$EXTRACT(BMEREC,106,107)
SET BMERESCE=$EXTRACT(BMEREC,17,17)
+8 ;Get Medicaid File Zip code
SET BMEMZIP=$EXTRACT(BMEREC,223,227)
+9 ;Strip out spaces
SET BMEMCNTY=$EXTRACT(BMEREC,91,105)
SET BMEMCTYN=$PIECE(BMEMCNTY," ",1)
+10 ;
+11 ;NEED TO GET COUNTY IEN FOR CHECK - THE "B" IS AN IEN ON PTR.
+12 ;Quit if No Medicaid County Name
IF $LENGTH(BMEMCTYN)=0
QUIT
+13 ;Check to see if AHCCCS County Name is in the (COUNTY SCREEN) File
SET BMESCNTY=$ORDER(^BMECTY("C",BMEMCTYN,0))
+14 SET BMEMSSN=$EXTRACT(BMEREC,27,35)
+15 ;
+16 ;Quit if Not in County Table
IF 'BMESCNTY
QUIT
+17 ;
DATE ;AHCCCS Dates (Y2K Conversion)
+1 ;AHCCCS Payment From Date/Beg
SET BMEMEBD=$$EBD
+2 ; AHCCCS Payment From/End
SET BMEMEED=$$EED
+3 ;AHCCCS Date of Birth
SET BMEMDOB=$$DOB
+4 ; Enrollment Date
SET BMEMERD=$$ERD
+5 ;Q:"AIAN"'[RACE
+6 ;Quit if no AHCCCS Beg Elig Dt in MED File
IF BMEMEBD=-1
QUIT
+7 ;Quit if no AHCCCS End Elig Dt in MED File
IF BMEMEED=-1
QUIT
+8 ;
+9 DO NEW
+10 QUIT
+11 ;
NEW ; -- create new entry in local BME MEDICAID ELIGIBLE (NO MATCH) File-Global ^BMETMED(
+1 ;Do not stuff the Medicaid End Elig Dt (EED Variable)
+2 ;Only stuff the Mediciad Beg Elig Dt (EEB/ERD Variables)
+3 DO ^XBFMK
KILL DIADD,DINUM
+4 SET X=BMEMEBD
SET DIC="^BMETMED("
SET DIC(0)="L"
SET DLAYGO=90332
+5 ;S DIC("DR")=".02////"_BMEFNAME
+6 SET DIC("DR")=".02////"_BMEMFULN_";.03////"_BMESEX_";.04///"_BMEMDOB_";.05////"_RES
+7 SET DIC("DR")=DIC("DR")_";.06////"_BMENUM_";.08////"_BMECOVTP_";4////"_BMEMRATE
+8 SET DIC("DR")=DIC("DR")_";1////"_BMEMSSN_";2////"_BMERESCE_";.09////"_BMEMEED
+9 IF BMESSNCK="Y"
SET DIC("DR")=DIC("DR")_";3///"_BMESSNCK
+10 IF BMEMKID="Y"
SET DIC("DR")=DIC("DR")_";5///"_BMEMKID
+11 DO FILE^DICN
DO ^XBFMK
KILL DIADD,DINUM
+12 QUIT
+13 ;
EED() ; -- eligibility end date
+1 ;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
+2 NEW X,Y
SET BMEYYYY=$EXTRACT(BMEREC,412,415)
SET BMEMMDD=$EXTRACT(BMEREC,416,419)
+3 SET BMEMEED=BMEMMDD_BMEYYYY
+4 SET X=BMEMEED
DO ^%DT
QUIT Y
+5 ;
EBD() ; -- eligibility begin date
+1 ;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
+2 NEW X,Y
SET BMEYYYY=$EXTRACT(BMEREC,347,350)
SET BMEMMDD=$EXTRACT(BMEREC,351,354)
+3 SET BMEMEBD=BMEMMDD_BMEYYYY
+4 SET X=BMEMEBD
DO ^%DT
QUIT Y
+5 ;
ERD() ; -- Med Enrollment Dt
+1 ;N X,Y S X=$E(BMEREC,406,411) D ^%DT Q Y
+2 NEW X,Y
SET BMEYYYY=$EXTRACT(BMEREC,347,350)
SET BMEMMDD=$EXTRACT(BMEREC,351,354)
+3 SET BMEMERD=BMEMMDD_BMEYYYY
+4 SET X=BMEMERD
DO ^%DT
QUIT Y
+5 ;
DOB() ;Date of Birth Conversion
+1 NEW X,Y
SET BMEYYYY=$EXTRACT(BMEMDOB,1,4)
SET BMEMMDD=$EXTRACT(BMEMDOB,5,8)
+2 SET BMEMDOB=BMEMMDD_BMEYYYY
+3 SET X=BMEMDOB
DO ^%DT
QUIT Y
+4 ;