AGFACE5 ; IHS/ASDS/EFG - FACE SHEET (MEDICAID) ;
;;7.1;PATIENT REGISTRATION;**4**;AUG 25,2005
;
G END:'$D(^AUPNMCD("AB",DFN))
S AG("STATE")=0,(AGHDG,AGPRTXTR,AGSTNUM)="N"
D HDG
S AGNINE=$$HTFM^XLFDT($H-275,1) ;Compute 9 Months earlier
GSTATE S AG("STATE")=$O(^AUPNMCD("AB",DFN,AG("STATE"))) G END:AG("STATE")="" S AGNUMBER=0
GNODE S AGNUMBER=$O(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER))
G GSTATE:AGNUMBER=""
W !,$$GET1^DIQ(5,AG("STATE"),1),?8,AGNUMBER
D PLNAME
S DA=$O(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER,0))
S %=$$GET1^DIQ(9000004,DA,2101)
W:$L(%) !?3,"NAME: ",%
S %=$$GET1^DIQ(9000004,DA,2102)
W:$L(%) !?3,"DATE OF BIRTH: ",%
W !
G GNODE
IENNODE ;
WRITLN ;
Q
WSTNUM ;
Q
WELIGDT ;
WMCNAM ;
END K AGHDG,IEN,AGNINE,AGNUMBER,AGPRTXTR,AG("STATE"),AGSTNUM,AGPLNUM
Q
HDG ;Q:AGHDG="Y" W !,AG("-"),!,"MEDICAID: " W:AGOPT(16)="Y" "(elig. dates null, or less than 9 months ago)"
Q:$G(AGHDG)="Y" W !,$G(AG("-")),!,"MEDICAID: " W:$G(AGOPT(16))="Y" "(elig. dates null, or less than 9 months ago)" ;AG*7.1*4 IM26968
W !,"STATE",?8,"NUMBER",?27,"(updated)",?40,"ELIG DATE",?54,"COVERAGE",?67,"ELIG END" S AGHDG="Y"
Q
PLNAME ;EP - Display Medicaid Plan Name info
;Get IEN of Patient in Medicaid Elig. File (^AUPNMCD)
N AGIEN,AGDATA,AGUPDT,AGBDT,AGEDT,AGINSPTR,AGPLNAME,AGCOV
S AGIEN=""
F S AGIEN=$O(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER,AGIEN)) Q:AGIEN="" D
.;Get data from 0th node of Mcaid Elig File
.S AGDATA=$G(^AUPNMCD(AGIEN,0))
.Q:AGDATA=""
.;Insurer pointer is the 10th piece of Medicaid Elig Files 0th node
.S AGINSPTR=$P(AGDATA,U,10)
.I $G(AGINSPTR)'="" D
..S AGPLNAME=$P($G(^AUTNINS(AGINSPTR,0)),U)
..W !,"PLAN: ",AGPLNAME
.E W !,"PLAN: (none)"
.S AGUPDT=0
.S Y=$P($G(^AUPNMCD(AGIEN,0)),U,8)
.D DD^%DT W ?25,"(",Y,")"
.F S AGUPDT=$O(^AUPNMCD(AGIEN,11,AGUPDT)) Q:'+AGUPDT D
..S AGBDT=$P($G(^AUPNMCD(AGIEN,11,AGUPDT,0)),U)
..S AGEDT=$P($G(^AUPNMCD(AGIEN,11,AGUPDT,0)),U,2)
..S AGCOV=$P($G(^AUPNMCD(AGIEN,11,AGUPDT,0)),U,3)
..I AGBDT>DT,(AGBDT'="") Q
..I AGOPT(16)="Y",AGBDT<AGNINE Q
..W ?40,$$FMTE^XLFDT(AGBDT,1),?57,$G(AGCOV),?66,$$FMTE^XLFDT(AGEDT,1),!
Q
AGFACE5 ; IHS/ASDS/EFG - FACE SHEET (MEDICAID) ;
+1 ;;7.1;PATIENT REGISTRATION;**4**;AUG 25,2005
+2 ;
+3 IF '$DATA(^AUPNMCD("AB",DFN))
GOTO END
+4 SET AG("STATE")=0
SET (AGHDG,AGPRTXTR,AGSTNUM)="N"
+5 DO HDG
+6 ;Compute 9 Months earlier
SET AGNINE=$$HTFM^XLFDT($HOROLOG-275,1)
GSTATE SET AG("STATE")=$ORDER(^AUPNMCD("AB",DFN,AG("STATE")))
IF AG("STATE")=""
GOTO END
SET AGNUMBER=0
GNODE SET AGNUMBER=$ORDER(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER))
+1 IF AGNUMBER=""
GOTO GSTATE
+2 WRITE !,$$GET1^DIQ(5,AG("STATE"),1),?8,AGNUMBER
+3 DO PLNAME
+4 SET DA=$ORDER(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER,0))
+5 SET %=$$GET1^DIQ(9000004,DA,2101)
+6 IF $LENGTH(%)
WRITE !?3,"NAME: ",%
+7 SET %=$$GET1^DIQ(9000004,DA,2102)
+8 IF $LENGTH(%)
WRITE !?3,"DATE OF BIRTH: ",%
+9 WRITE !
+10 GOTO GNODE
IENNODE ;
WRITLN ;
+1 QUIT
WSTNUM ;
+1 QUIT
WELIGDT ;
WMCNAM ;
END KILL AGHDG,IEN,AGNINE,AGNUMBER,AGPRTXTR,AG("STATE"),AGSTNUM,AGPLNUM
+1 QUIT
HDG ;Q:AGHDG="Y" W !,AG("-"),!,"MEDICAID: " W:AGOPT(16)="Y" "(elig. dates null, or less than 9 months ago)"
+1 ;AG*7.1*4 IM26968
IF $GET(AGHDG)="Y"
QUIT
WRITE !,$GET(AG("-")),!,"MEDICAID: "
IF $GET(AGOPT(16))="Y"
WRITE "(elig. dates null, or less than 9 months ago)"
+2 WRITE !,"STATE",?8,"NUMBER",?27,"(updated)",?40,"ELIG DATE",?54,"COVERAGE",?67,"ELIG END"
SET AGHDG="Y"
+3 QUIT
PLNAME ;EP - Display Medicaid Plan Name info
+1 ;Get IEN of Patient in Medicaid Elig. File (^AUPNMCD)
+2 NEW AGIEN,AGDATA,AGUPDT,AGBDT,AGEDT,AGINSPTR,AGPLNAME,AGCOV
+3 SET AGIEN=""
+4 FOR
SET AGIEN=$ORDER(^AUPNMCD("AB",DFN,AG("STATE"),AGNUMBER,AGIEN))
IF AGIEN=""
QUIT
Begin DoDot:1
+5 ;Get data from 0th node of Mcaid Elig File
+6 SET AGDATA=$GET(^AUPNMCD(AGIEN,0))
+7 IF AGDATA=""
QUIT
+8 ;Insurer pointer is the 10th piece of Medicaid Elig Files 0th node
+9 SET AGINSPTR=$PIECE(AGDATA,U,10)
+10 IF $GET(AGINSPTR)'=""
Begin DoDot:2
+11 SET AGPLNAME=$PIECE($GET(^AUTNINS(AGINSPTR,0)),U)
+12 WRITE !,"PLAN: ",AGPLNAME
End DoDot:2
+13 IF '$TEST
WRITE !,"PLAN: (none)"
+14 SET AGUPDT=0
+15 SET Y=$PIECE($GET(^AUPNMCD(AGIEN,0)),U,8)
+16 DO DD^%DT
WRITE ?25,"(",Y,")"
+17 FOR
SET AGUPDT=$ORDER(^AUPNMCD(AGIEN,11,AGUPDT))
IF '+AGUPDT
QUIT
Begin DoDot:2
+18 SET AGBDT=$PIECE($GET(^AUPNMCD(AGIEN,11,AGUPDT,0)),U)
+19 SET AGEDT=$PIECE($GET(^AUPNMCD(AGIEN,11,AGUPDT,0)),U,2)
+20 SET AGCOV=$PIECE($GET(^AUPNMCD(AGIEN,11,AGUPDT,0)),U,3)
+21 IF AGBDT>DT
IF (AGBDT'="")
QUIT
+22 IF AGOPT(16)="Y"
IF AGBDT<AGNINE
QUIT
+23 WRITE ?40,$$FMTE^XLFDT(AGBDT,1),?57,$GET(AGCOV),?66,$$FMTE^XLFDT(AGEDT,1),!
End DoDot:2
End DoDot:1
+24 QUIT