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

AG4.m

Go to the documentation of this file.
AG4 ; IHS/ASDS/EFG - ENTER MEDICARE DATA ;  
 ;;7.1;PATIENT REGISTRATION;**1,2,11,13**;AUG 25, 2005;Build 1
 ;IHS/OIT/NKD AG*7.1*11 MU2 UNKNOWN SEX
 ;IHS/OIT/NKD AG*7.1*13 MBI IMPLEMENTATION
 ;
L1 S AG("LT")=$S($D(^AUPNMCR(DFN,0)):"YES",1:"NO")
 W !!,"Does this patient have MEDICARE COVERAGE? (Y/N) ",AG("LT"),"// "
 D READ^AG
 S AG("LT")=$S($E(Y)="Y":"YES",1:"NO")
 Q:$D(DTOUT)!$D(DFOUT)
 ;TESTING USE OF EDIT SCREEN FOR ADDING INSURANCE TO NEW PATIENT 5/13/2005
 I $G(^AGFAC(DUZ(2),"NEWADDINS")) I AG("LT")="YES" S AGPAT=$P($G(^DPT(DFN,0)),U) S AGXTERN=1 D EN^AGED4("") K AGXTERN,DUOUT G:$G(NEWENTRY)=0 ^AG5 G L1
 I $G(^AGFAC(DUZ(2),"NEWADDINS")),$D(DUOUT) G DUOUT^AG3
 I $G(^AGFAC(DUZ(2),"NEWADDINS")),($G(AG("LT"))="NO") G ^AG5
 ;TESTING
 G L2:Y["Y"
 G END1:Y["N"!($D(DLOUT)&(AG("LT")="NO"))
 G L2:$D(DLOUT)&(AG("LT")="YES") I $D(DUOUT) G DUOUT^AG3
 D YN^AG G L1
ADDNEW ;EP - ADD NEW MEDICARE CLIENT.
L2 W !
 ;BEGIN AG*7.1*2 IM20637
 I $$ISMINOR^AGUTILS(DFN) D  G:'Y END1
 .K DIR
 .S DIR(0)="Y"
 .S DIR("A")="A MINOR CANNOT BE THE POLICY HOLDER FOR MEDICARE ..DO YOU WISH TO ADD ENTRY?//"  ;IHS/SD/TPF 4/28/2006 AG*7.1*2 IM20637
 .S DIR("B")="N"
 .D ^DIR
 ;END AG*7.1*2 IM20637
 S NEWENTRY=1  ;IHS/SD/TPF 12/6/2005 AG*7.1*1
 I $G(AGTYPE)="MD" G ADDCOV  ;IHS/SD/TPF 12/6/2005 AG*7.1*1 ITEM 2
 K DIE,DIC,DR,DIR
 S DIE="^AUPNPAT("
 ;REQUIRE MEDICARE REL DATE
 S DR=".04R",DA=DFN
 D ^DIE Q:$D(Y)&$D(AG("EDIT"))  G L1:$D(Y) G L3:$D(^AUPNMCR(DFN,0))
 S AG("INS")=$O(^AUTNINS("B","MEDICARE",""))
 K DIC,DIE,DR,DIR,D0,DD
 S DIC="^AUPNMCR("
 S DIC(0)="L"
 S X="`"_DFN
 D ^DIC
 Q:+Y<0
 S DA=+Y
 S DIE="^AUPNMCR(",DA=DFN,DR=".02///"_AG("INS")
 D ^DIE
L3 ;
 ;W !!,"Enter the MEDICARE INSURANCE NUMBER (""suffix"" will be asked seperately)."
L4 ;REQUIRE MCR NUMBER
 ;S DR=".03R",DA=DFN
 ;S DIE="^AUPNMCR("
 ;D ^DIE
 ;I $D(Y) G L2
L5 ;
 ;S DIE="^AUPNMCR("
 ;REQUIRE SUFFIX
 ;S DA=DFN,DR=".04R"
 ;D ^DIE
 ;I $D(Y) G L4
 D EDITMCR^AGUTL(DFN,1)  ;IHS/OIT/NKD AG*7.1*13
 S DIE="^AUPNMCR(",DA=DFN
 S ADDCHK=""
 ;REQUIRE MCR NAME
 S DR="2101R"
 I $G(NEWENTRY)!($P($G(^AUPNMCR(DA,21)),U)="") S DR=DR_"//"_$P($G(^DPT(DFN,0)),U)
 D ^DIE
 I '$D(^AUPNMCR(DFN,21)) G L6
L6 ;REQUIRE MCR DOB
 S DR="2102R"
 I $G(NEWENTRY)!($P($G(^AUPNMCR(DA,21)),U,2)="") N AGDOB,Y S Y=$P($G(^DPT(DFN,0)),U,3) X ^DD("DD") S AGDOB=Y S DR=DR_"//"_AGDOB K Y
 D ^DIE
 K AGDOB
QMB S DR=.08,DA=DFN
 S DIE="^AUPNMCR("
 D ^DIE
IMPMSG ;
 S DIC(0)="LMQE"
 S DA(1)=DFN
 S DIC="^AUPNMCR("_DA(1)_",12,"
 D ^DIC
 ;
PCP S DR=.14,DA=DFN
 S DIE="^AUPNMCR("
 D ^DIE
CC S DR=.15,DA=DFN
 S DIE="^AUPNMCR("
 D ^DIE
CCD S DR=.16,DA=DFN
 S DIE="^AUPNMCR("
 D ^DIE
ADDCOV ;EP - ADD NEW COVERAGE.
L7 W !!,"Enter the ELIGIBILITY DATE: "
 D:'$D(AG("EDIT")) DFLT1
 D READ^AG
 I Y="" W !,"MEDICARE ELIGIBILITY DATE REQUIRED!" H 2 G L7
 Q:$D(DUOUT)&$D(AG("EDIT"))  G END1:$D(DTOUT)!$D(DFOUT)!($D(DLOUT)&'$D(AG("LT1"))),L5:$D(DUOUT),L8:$D(DLOUT)
 S:$D(DQOUT) Y="?"
 S X=Y,%DT="EX"
 D ^%DT
 G L7:Y<2600000!(Y>(DT+20000))
 I Y>DT W *7,!!,"SURE ABOUT THE FUTURE START DATE" S %=2 D YN^DICN G:%=2 L7
 S AG("DT")=Y
 K AG("COV"),COVTYP  ;IHS/OIT/NKD AG*7.1*13
 ;L8 I $G(AGTYPE)="MD" S AG("COV")="D" K AG("MORE") G L9  ;IHS/SD/TPF 12/2/2005 AG*7.1*1
L8  ;I $G(AGTYPE)="MD" S AG("COV")="D" K AG("MORE") G L9  ;IHS/SD/TPF 12/2/2005 AG*7.1*1  ;IHS/OIT/NKD AG*7.1*13
 ;W !!,"Type of COVERAGE (A, B): "
 W !!,"Type of COVERAGE (A, B, D): "
 D:'$D(AG("EDIT")) DFLT2
 D READ^AG
 I Y="D",$$NOPARTAB^AGED4(DFN) W !,"PATIENT MUST HAVE MEDICARE PART A OR B BEFORE BEING ELIGIBLE FOR PART D!" G L8  ;AG*7.1*1 ITEM 2
 ;I Y="D",(AGELP("INS")=2) W !!,"DO NOT ADD PART D COVERAGE TO A MEDICARE INSURER ENTRY",!,"REFER TO PATCH 1 ADDENDUM IN HOW TO SET UP PART D INSURERS",! G L8  ;IHS/SD/TPF 4/25/2006 AG*7.1*2 IM20523
 ;I Y="D",($P($G(^AUTNINS(AGELP("INS"),2)),U)'="MD") W !!,"CAN NOT ADD PART D COVERAGE TO A NON MEDICARE PART D INSURER",!,"REFER TO PATCH 1 ADDENDUM IN HOW TO SET UP PART D INSURERS",! G L8
 ;COVERAGE TYPE IS REQUIRED
 ;I Y="" W !,"Enter either ""A"" or ""B""." G L8
 I Y="" W !,"Enter either ""A"" or ""B"" or ""D""." G L8
 G END1:$D(DTOUT)!$D(DFOUT)!($D(DLOUT)&'$D(AG("LT2"))),L7:$D(DUOUT),L9:$D(DLOUT)
 ;I $D(DQOUT)!((Y'="A")&(Y'="B")) W !,"Enter either ""A"" or ""B""." G L8
 I $D(DQOUT)!((Y'="A")&(Y'="B")&(Y'="D")) W !,"Enter either ""A"" or ""B"" or ""D""." G L8
 ;I $D(DQOUT)!((Y'="A")&(Y'="B")) D  H 3 G L8  ;IHS/SD/TPF 12/2/2005 AG*7.1*1
 ;.I Y'="D" W !,"Enter either ""A"" or ""B""." Q
 ;.W !,"You cannot Enter a new Part D on this page."
 ;.W !,"Go to the Summary page and choose a Medicare Part D type of insurer"
 S AG("COV")=Y
 K AG("MORE")
L9 S DIE="^AUPNMCR("
 ;IHS/SD/TPF 12/7/05 UNREPORTED BUG FIX PER ADRIAN (updated) COLUMN ON DISPLAY HAS NO DATE
 S DR=".07///^S X=DT"
 D ^DIE
 ;END
 ;LINE BELOW ALLOWS ENTRY OF SAME DATE EVEN THOUGH THIS FIELD IS DINUMED
 ;THIS IS SO MEDICARE PART A AND B CAN BE ENTERED UNDER THE SAME DATE
 S DR="1101///"_$C(34)_AG("DT")_$C(34)
 S DR(2,9000003.11)=".03///"_AG("COV")
 ;IHS/OIT/NKD AG*7.1*11 MU2 - STUFF PT SEX INTO ELIGIBLE SEX FIELD - START NEW CODE
 N AGSEX
 S AGSEX=$$GET1^DIQ(2,DFN,.02,"I")
 S DR(2,9000003.11)=DR(2,9000003.11)_";.08////^S X=AGSEX"
 ;IHS/OIT/NKD AG*7.1*11 MU2 - END NEW CODE
 S DA=DFN
 D ^DIE
 ;BEGIN NEW CODE IHS/SD/TPF 12/2/2005 AG*7.1*1 ITEM 1
 ;S DIE("NO^")="BACK"
 I $G(AG("COV"))="D" D ASKPARTD(DFN,D1) S NEWENTRY=0 D EN^AGED4PD(COMPIEN) K AG("MORE") Q:$D(AG("EDIT"))  ;AG*7.1*2 REPORTED DURING ALPHA 11/9/2006 AG("EDIT") SHOULD BE DEFINED ONLY WHEN EDITING A PAT.
 ;E  D ^DIE
 ;END NEW CODE
 I $G(GOL8) G L8  ;IHS/SD/TPF 12/2/2005 AG*7.1*1 ITEM 1
 K DIE,DIC,DR,DA
END Q:$D(AG("EDIT"))
 D MORE
 G ADDCOV:$D(AG("MORE")) K AG
 G ^AG5
END1 G END:'$D(^AUPNMCR(DFN,0))!$D(AG("EDIT"))
 S DA=DFN
 S DIE="^AUPNMCR("
 S DR=".01///@"
 D ^DIE
 G END
DUOUT ;EP
 G L1
DFLT1 K AG("LT1")
 Q:'$D(^AUPNMCR(DFN,11,1,0))
 S DIC=9000003.11
 ;REQUIRE ELIG BEGIN DATE
 S DR=".01R",DA=DFN,AG("DRENT")=1
 D ^AGDICLK
 Q:$D(AG("LKERR"))
 S AG("LT1")=AG("LKPRINT")
 S AG("DT")=AG("LKDATA")
 W AG("LKPRINT"),"// "
 Q
DFLT2 K AG("LT2")
 Q:'$D(^AUPNMCR(DFN,11,1,0))
 S (AG("LT2"),AG("COV"))=$P(^AUPNMCR(DFN,11,1,0),U,3)
 Q:AG("LT2")=""
 W AG("LT2"),"// "
 Q
MORE K AG("MORE")
 Q:'$D(^AUPNMCR(DFN,11,0))
 W !!,"Do you wish to ADD ANOTHER COVERAGE TYPE? (Y/N) NO// "
 D READ^AG
 Q:$D(DTOUT)!$D(DFOUT)!$D(DLOUT)!(Y["N")
 G MORE1:Y["Y"
 D YN^AG
 G MORE
MORE1 S AG("MORE")=""
 Q
ASKPARTD(DFN,D1) ;ASK PART D FIELDS
 K DIC,DIE,DR,DA
 S GOL8=0
 S DA=D1
 S DA(1)=DFN
 S DIE="^AUPNMCR("_DA(1)_",11,"
F04 ;EP
 S COMPIEN=DA(1)_",11,"_DA_",0"
 ;I $G(AGELP("INS"))'="" S DR=".04R//^S X=$P(^AUTNINS($G(AGELP(""INS"")),0),U)"
 I $G(AGELP("INS"))'="",($G(AGELP("INS"))'=2) S DR=".04R//^S X=$P(^AUTNINS($G(AGELP(""INS"")),0),U)"
 E  S DR=".04R"
 D ^DIE
 I $D(Y) S GOL8=1 Q
F05 ;EP
 S DR=".05R//^S X=$P($G(^AUPNMCR(DA(1),21)),U)"
 D ^DIE
 I $D(Y) G F04
F06 ;EP
 K DR
 ;S DR=".06R//^S X=$P($G(^AUPNMCR(DA(1),0)),U,3)"
 S DR=".06R//"_$$GETMCR^AGUTL(DFN)  ;IHS/OIT/NKD AG*7.1*13
 D ^DIE
 I $D(Y) G F05
F07 ;EP
 S DR=".07"
 D ^DIE
 I $D(Y) G F06
F08 ;EP
 S DR=".08R//^S X=$P($G(^DPT(DA(1),0)),U,2)"
 D ^DIE
 I $D(Y) G F07
F09 ;EP
 S DR=".09R//^S X=$P($G(^DPT(DA(1),0)),U,3)"
 D ^DIE
 I $D(Y) G F08
F11 ;EP
 S DR=".11"
 D ^DIE
 I $D(Y) G F09
F13 ;EP
 S DR=".13R"
 D ^DIE
 I $D(Y) G F11
 Q