BMEMED0 ; IHS/PHXAO/TMJ - STUFF MEDICAID SCRATCH INTO FILEMAN FILE ; [ 06/11/03 3:27 PM ]
;1.0;AZA MEDICAID ELIGIBILITY FILES;MARCH 14, 1994
;
;This Routine is called from AZAMED Routine when
;a NO MATCH Record is hit. This Routine populates the
;Temporary Monthly No Match File ^AZAMED(Global
;This File is utilized to manually compare and update
;Patient Registration
;
; -- new necessary variables
;N NAME,SEX,DOB,RES,NUM,RACE,CT,RESCE,EBD,EED,SSN,IEN
;
; -- set up variables for stuff in AHCCCS Medicaid File
SET S N=^AZAGMED(IFN)
S FNAME=$E(N,131,140),LNAME=$E(N,108,130)
S FNAME=$P(FNAME," ",1),LNAME=$P(LNAME," ",1) ;Strip out spaces in both names
S MFULNAME=LNAME_","_FNAME
S CITY=$E(N,286,305),STATE=$E(N,306,307)
S CITY=$P(CITY," ",1) S RES=CITY_", "_STATE
S SEX=$E(N,142,142),DOB=$E(N,143,150),MRATE=$E(N,355,358)
S NUM=$E(N,18,26),CT=$E(N,106,107),RESCE=$E(N,17,17)
S MZIP=$E(N,223,227) ;Get Medicaid File Zip code
S MCOUNTY=$E(N,91,105) S MCTYNAME=$P(MCOUNTY," ",1) ;Strip out spaces
;
;NEED TO GET COUNTY IEN FOR CHECK - THE "B" IS AN IEN ON PTR.
;WENT HOME FOR THE WEEKEND - I'M TIRED.
Q:$L(MCTYNAME)=0 ;Quit if No Medicaid County Name
S SCOUNTY=$O(^AZAMEDZP(1180004,"C",MCTYNAME,0)) ;Check to see if AHCCCS County Name is in the (COUNTY SCREEN) File
S SSN=$E(N,27,35)
;
I 'SCOUNTY Q ;Quit if Not in County Table
;
DATE ;AHCCCS Dates (Y2K Conversion)
S EBD=$$EBD ;AHCCCS Payment From Date/Beg
S EED=$$EED ; AHCCCS Payment From/End
S DOB=$$DOB ;AHCCCS Date of Birth
S ERD=$$ERD ; Enrollment Date
;Q:"AIAN"'[RACE
Q:EBD=-1 ;Quit if no AHCCCS Beg Elig Dt in MED File
Q:EED=-1 ;Quit if no AHCCCS End Elig Dt in MED File
;
D NEW
Q
;
NEW ; -- create new entry in local AZA MEDICAID ELIGIBLE (NO SSN) File-Global ^AZAMED(
;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=EBD,DIC="^AZAMED(",DIC(0)="L",DLAYGO=1180004
;S DIC("DR")=".02////"_FNAME
S DIC("DR")=".02////"_MFULNAME_";.03////"_SEX_";.04///"_DOB_";.05////"_RES
S DIC("DR")=DIC("DR")_";.06////"_NUM_";.08////"_CT_";4////"_MRATE
S DIC("DR")=DIC("DR")_";1////"_SSN_";2////"_RESCE_";.09////"_EED
;I DUZ=5703 W !! ZW W !! ;DEBUG
I SSNMATCH="Y" S DIC("DR")=DIC("DR")_";3///"_SSNMATCH
I MKID="Y" S DIC("DR")=DIC("DR")_";5///"_MKID
D FILE^DICN D ^XBFMK K DIADD,DINUM
Q
;
EED() ; -- eligibility end date
;N X,Y S X=$E(N,406,411) D ^%DT Q Y
N X,Y S YYYY=$E(N,412,415),MMDD=$E(N,416,419)
S EED=MMDD_YYYY
S X=EED D ^%DT Q Y
;
EBD() ; -- eligibility begin date
;N X,Y S X=$E(N,406,411) D ^%DT Q Y
N X,Y S YYYY=$E(N,347,350),MMDD=$E(N,351,354)
S EBD=MMDD_YYYY
S X=EBD D ^%DT Q Y
;
ERD() ; -- Med Enrollment Dt
;N X,Y S X=$E(N,406,411) D ^%DT Q Y
N X,Y S YYYY=$E(N,347,350),MMDD=$E(N,351,354)
S ERD=MMDD_YYYY
S X=ERD D ^%DT Q Y
;
DOB() ;Date of Birth Conversion
N X,Y S YYYY=$E(DOB,1,4),MMDD=$E(DOB,5,8)
S DOB=MMDD_YYYY
S X=DOB D ^%DT Q Y
;
BMEMED0 ; IHS/PHXAO/TMJ - STUFF MEDICAID SCRATCH INTO FILEMAN FILE ; [ 06/11/03 3:27 PM ]
+1 ;1.0;AZA MEDICAID ELIGIBILITY FILES;MARCH 14, 1994
+2 ;
+3 ;This Routine is called from AZAMED Routine when
+4 ;a NO MATCH Record is hit. This Routine populates the
+5 ;Temporary Monthly No Match File ^AZAMED(Global
+6 ;This File is utilized to manually compare and update
+7 ;Patient Registration
+8 ;
+9 ; -- new necessary variables
+10 ;N NAME,SEX,DOB,RES,NUM,RACE,CT,RESCE,EBD,EED,SSN,IEN
+11 ;
+12 ; -- set up variables for stuff in AHCCCS Medicaid File
SET SET N=^AZAGMED(IFN)
+1 SET FNAME=$EXTRACT(N,131,140)
SET LNAME=$EXTRACT(N,108,130)
+2 ;Strip out spaces in both names
SET FNAME=$PIECE(FNAME," ",1)
SET LNAME=$PIECE(LNAME," ",1)
+3 SET MFULNAME=LNAME_","_FNAME
+4 SET CITY=$EXTRACT(N,286,305)
SET STATE=$EXTRACT(N,306,307)
+5 SET CITY=$PIECE(CITY," ",1)
SET RES=CITY_", "_STATE
+6 SET SEX=$EXTRACT(N,142,142)
SET DOB=$EXTRACT(N,143,150)
SET MRATE=$EXTRACT(N,355,358)
+7 SET NUM=$EXTRACT(N,18,26)
SET CT=$EXTRACT(N,106,107)
SET RESCE=$EXTRACT(N,17,17)
+8 ;Get Medicaid File Zip code
SET MZIP=$EXTRACT(N,223,227)
+9 ;Strip out spaces
SET MCOUNTY=$EXTRACT(N,91,105)
SET MCTYNAME=$PIECE(MCOUNTY," ",1)
+10 ;
+11 ;NEED TO GET COUNTY IEN FOR CHECK - THE "B" IS AN IEN ON PTR.
+12 ;WENT HOME FOR THE WEEKEND - I'M TIRED.
+13 ;Quit if No Medicaid County Name
IF $LENGTH(MCTYNAME)=0
QUIT
+14 ;Check to see if AHCCCS County Name is in the (COUNTY SCREEN) File
SET SCOUNTY=$ORDER(^AZAMEDZP(1180004,"C",MCTYNAME,0))
+15 SET SSN=$EXTRACT(N,27,35)
+16 ;
+17 ;Quit if Not in County Table
IF 'SCOUNTY
QUIT
+18 ;
DATE ;AHCCCS Dates (Y2K Conversion)
+1 ;AHCCCS Payment From Date/Beg
SET EBD=$$EBD
+2 ; AHCCCS Payment From/End
SET EED=$$EED
+3 ;AHCCCS Date of Birth
SET DOB=$$DOB
+4 ; Enrollment Date
SET ERD=$$ERD
+5 ;Q:"AIAN"'[RACE
+6 ;Quit if no AHCCCS Beg Elig Dt in MED File
IF EBD=-1
QUIT
+7 ;Quit if no AHCCCS End Elig Dt in MED File
IF EED=-1
QUIT
+8 ;
+9 DO NEW
+10 QUIT
+11 ;
NEW ; -- create new entry in local AZA MEDICAID ELIGIBLE (NO SSN) File-Global ^AZAMED(
+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=EBD
SET DIC="^AZAMED("
SET DIC(0)="L"
SET DLAYGO=1180004
+5 ;S DIC("DR")=".02////"_FNAME
+6 SET DIC("DR")=".02////"_MFULNAME_";.03////"_SEX_";.04///"_DOB_";.05////"_RES
+7 SET DIC("DR")=DIC("DR")_";.06////"_NUM_";.08////"_CT_";4////"_MRATE
+8 SET DIC("DR")=DIC("DR")_";1////"_SSN_";2////"_RESCE_";.09////"_EED
+9 ;I DUZ=5703 W !! ZW W !! ;DEBUG
+10 IF SSNMATCH="Y"
SET DIC("DR")=DIC("DR")_";3///"_SSNMATCH
+11 IF MKID="Y"
SET DIC("DR")=DIC("DR")_";5///"_MKID
+12 DO FILE^DICN
DO ^XBFMK
KILL DIADD,DINUM
+13 QUIT
+14 ;
EED() ; -- eligibility end date
+1 ;N X,Y S X=$E(N,406,411) D ^%DT Q Y
+2 NEW X,Y
SET YYYY=$EXTRACT(N,412,415)
SET MMDD=$EXTRACT(N,416,419)
+3 SET EED=MMDD_YYYY
+4 SET X=EED
DO ^%DT
QUIT Y
+5 ;
EBD() ; -- eligibility begin date
+1 ;N X,Y S X=$E(N,406,411) D ^%DT Q Y
+2 NEW X,Y
SET YYYY=$EXTRACT(N,347,350)
SET MMDD=$EXTRACT(N,351,354)
+3 SET EBD=MMDD_YYYY
+4 SET X=EBD
DO ^%DT
QUIT Y
+5 ;
ERD() ; -- Med Enrollment Dt
+1 ;N X,Y S X=$E(N,406,411) D ^%DT Q Y
+2 NEW X,Y
SET YYYY=$EXTRACT(N,347,350)
SET MMDD=$EXTRACT(N,351,354)
+3 SET ERD=MMDD_YYYY
+4 SET X=ERD
DO ^%DT
QUIT Y
+5 ;
DOB() ;Date of Birth Conversion
+1 NEW X,Y
SET YYYY=$EXTRACT(DOB,1,4)
SET MMDD=$EXTRACT(DOB,5,8)
+2 SET DOB=MMDD_YYYY
+3 SET X=DOB
DO ^%DT
QUIT Y
+4 ;