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

AGEVLM.m

Go to the documentation of this file.
AGEVLM ; cmi/flag/maw - AGEV Insurance Eligibility Verification ;  
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
MAIN ;-- main routine driver
 W:$D(IOF) @IOF
 F J=1:1:5 S X=$P($T(TEXT+J),";;",2) W !?80-$L(X)\2,X
 KILL X,J
 W !!
 S AGEVPLPT=""
 F  D GETPAT Q:AGEVPLPT=""  S DFN=AGEVPLPT D EN1,FULL^VALM1,EXIT K AGEVPLPT
 D EOJ
 Q
 ;
GETPAT ;-- get patient
 KILL AGEVPLPT,AGEVLOC,AGEVPAT,AGEVDATE,AGEVPIEN,AGEVAF,AGEVPRB,AGEVOVRR
 KILL AGEVLOOK,AGEVPDFN
 D KILL^AUPNPAT
 S AGEVPLPT=""
 W !
 S DIC="^AGEVH(",DIC(0)="AEMQ"
 D ^DIC
 KILL DIC
 Q:Y<0
 S AGEVF=+Y,AGEVPLPT=$P(Y,U,2)
 Q
 ;
EOJ ;-- end of job cleanup
 D:$D(VALMWD) CLEAR^VALM1 ;clears out all list man stuff
 K XQORNEST,VALMKEY,VALM,VALMAR,VALMBCK,VALMBG,VALMCAP,VALMCNT,VALMOFF
 K VALMMCON,VALMDN,VALMEVL,VALMIOXY,VALMKEY,VALMLFT,VALMLST,VALMMENU
 K VALMSGR,VALMUP,VALMWD,VALMY,XQORS,XQORSPEW
 K AGEVPLPT,AGEVLOC,AGEVPAT,AGEVDATE,AGEVPIEN,AGEVAF,AGEVPRB,AGEVOVRR
 K AGEVLOOK,AGEVPDFN
 D KILL^AUPNPAT,EN^XBVK("BHLX"),EN^XBVK("AGEV")
 Q
 ;
EN1 ;PEP - requires DFN to be set to patient
 Q:'$G(DFN)
 S AGEVPLPT=DFN
 Q:'$G(AGEVPLPT)
 Q:'$D(^AUPNPAT(AGEVPLPT))
 Q:'$D(^DPT(AGEVPLPT))
 S Y=AGEVPLPT
 D ^AUPNPAT,EN
 KILL AGEVPLPT
 D FULL^VALM1,EXIT
 Q
 ;
EN ;PEP - main entry point for AGEV ELIGIBILITY VERIFICATION
 S VALMCC=1 ;1 means screen mode, 0 means scrolling mode
 D EN^VALM("AGEV ELIGIBILITY VERIFICATION"),CLEAR^VALM1
 Q
 ;
HDR ;EP - header code
 S VALMHDR(1)=$TR($J(" ",80)," ","-")
 S VALMHDR(2)="Name: "_IORVON_$E($P(^DPT(AGEVPLPT,0),U),1,30)_IOINORM
 S VALMHDR(2)=VALMHDR(2)_"  DOB: "_$$FTIME^VALM1(AUPNDOB)_"  Sex: "
 S VALMHDR(2)=VALMHDR(2)_$P(^DPT(AGEVPLPT,0),U,2)_"  HRN: "
 S VALMHDR(2)=VALMHDR(2)_$S($D(^AUPNPAT(AGEVPLPT,41,DUZ(2),0)):$P(^AUPNPAT(AGEVPLPT,41,DUZ(2),0),U,2),1:"????")
 S VALMHDR(3)=$TR($J(" ",80)," ","-")
 Q
 ;
INIT ;-- init variables and list array
 D GATHER
 S VALMCNT=AGEVLINE  ;this variable must be the total number of line
 Q
 ;
GATHER ;EP - this gets the particular patient
 ;set up array containing insurances for the patient
 ;**** see page 7 of List Manager Manual for info on how to
 ;**** set up the array that contains the list
 KILL AGEVQUIT,AGEVPL
 S (AGEVCNT,AGEVRCNT,AGEVLINE)=0
 I '$O(^AGEVH("B",AGEVPLPT,0)) D  Q
 . S ^TMP("AGEV",$J,1,0)="No insurance entries currently on file"
 . S ^TMP("AGEV",$J,"IDX",1,1)=""
 . S AGEVRCNT=1
 .Q
 S AGEVAF="A"
 D GATHER1
 Q
 ;
GATHER1 ;-- this gets the patient and policy holder information
 Q:'$G(^AGEVH(AGEVF,0))
 S AGEVH0=$G(^AGEVH(AGEVF,0)),AGEVH1=$G(^AGEVH(AGEVF,1))
 Q:AGEVH1=""
 S AGEVINS=$P(AGEVH0,U,2)
 Q:AGEVINS=""
 S AGEVPOLH=$P(AGEVH1,U)
 S AGEVPOLN=$P(AGEVH1,U,3)
 S AGEVPOLG=$P(AGEVH1,U,4)
 S AGEVPHSX=$P(AGEVH1,U,5)
 S AGEVPST=$P(AGEVH1,U,8)
 S AGEVPDOB=$$FMTE^XLFDT($P(AGEVH1,U,10))
 D SUB,DEP
 I $$GET1^DIQ(9999999.18,AGEVINS,.01)["MEDICAID" D MCD^AGEVLM0 Q
 I $$GET1^DIQ(9999999.18,AGEVINS,.01)["MEDICARE" D MCR^AGEVLM0 Q
 I $$GET1^DIQ(9999999.18,AGEVINS,.01)["RAILROAD" D RR^AGEVLM0 Q
 D PI^AGEVLM0
 Q
 ;
SUB ;-- this gets the subscriber information
 S AGEVHDA=0
 F  S AGEVHDA=$O(^AGEVH(AGEVF,2,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("SUB REQ VAL",AGEVHDA)=$G(^AGEVH(AGEVF,2,AGEVHDA,0))
 .Q
 S AGEVHDA=0
 F  S AGEVHDA=$O(^AGEVH(AGEVF,2.5,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("SUB DTP",AGEVHDA)=$P($G(^AGEVH(AGEVF,2.5,AGEVHDA,0)),U)
 . S $P(AGEV("SUB DTP",AGEVHDA),U,2)=$P($G(^AGEVH(AGEVF,2.5,AGEVHDA,0)),U,2)
 .Q
 S AGEVHDA=0
 F  S AGEVHDA=$O(^AGEVH(AGEVF,3,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("SUB ELG INFO",AGEVHDA)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,0)),U)
 . S $P(AGEV("SUB ELG INFO",AGEVHDA),U,2)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,0)),U,2)
 . S $P(AGEV("SUB ELG INFO",AGEVHDA),U,3)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,0)),U,3)
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,3,AGEVHDA,"REF",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("SUB REF ID",AGEVHDA,AGEVADA)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,"REF",AGEVADA,0)),U)
 .. S $P(AGEV("SUB REF ID",AGEVHDA,AGEVADA),U,2)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,"REF",AGEVADA,0)),U,2)
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,3,AGEVHDA,"AAA",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("SUB ELG REQ VAL",AGEVHDA,AGEVADA)=$G(^AGEVH(AGEVF,3,AGEVHDA,"AAA",AGEVADA,0))
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,3,AGEVHDA,"DTP",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("SUB ELG DTP",AGEVHDA,AGEVADA)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,"DTP",AGEVADA,0)),U)
 .. S $P(AGEV("SUB ELG DTP",AGEVHDA,AGEVADA),U,2)=$P($G(^AGEVH(AGEVF,3,AGEVHDA,"DTP",AGEVADA,0)),U,2)
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,3,AGEVHDA,"MSG",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("SUB ELG MSG",AGEVHDA,AGEVADA)=$G(^AGEVH(AGEVF,3,AGEVHDA,"MSG",AGEVADA,0))
 ..Q
 .Q
 Q
 ;
DEP ;-- this gets the dependent information
 S AGEVHDA=0
 F  S AGEVHDA=$O(^AGEVH(AGEVF,4,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("DEP REQ VAL",AGEVHDA)=$G(^AGEVH(AGEVF,4,AGEVHDA,0))
 .Q
 S AGEVHDA=0
 F  S AGEVHDA=$O(^AGEVH(AGEVF,4.5,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("DEP DTP",AGEVHDA)=$P($G(^AGEVH(AGEVF,4.5,AGEVHDA,0)),U)
 . S $P(AGEV("DEP DTP",AGEVHDA),U,2)=$P($G(^AGEVH(AGEVF,4.5,AGEVHDA,0)),U,2)
 S AGEVHDA=0 F  S AGEVHDA=$O(^AGEVH(AGEVF,5,AGEVHDA)) Q:'AGEVHDA  D
 . S AGEV("DEP ELG INFO",AGEVHDA)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,0)),U)
 . S $P(AGEV("DEP ELG INFO",AGEVHDA),U,2)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,0)),U,2)
 . S $P(AGEV("DEP ELG INFO",AGEVHDA),U,3)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,0)),U,3)
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,5,AGEVHDA,"REF",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("DEP REF ID",AGEVHDA,AGEVADA)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,"REF",AGEVADA,0)),U)
 .. S $P(AGEV("DEP REF ID",AGEVHDA,AGEVADA),U,2)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,"REF",AGEVADA,0)),U,2)
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,5,AGEVHDA,"AAA",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("DEP ELG REQ VAL",AGEVHDA,AGEVADA)=$G(^AGEVH(AGEVF,5,AGEVHDA,"AAA",AGEVADA,0))
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,5,AGEVHDA,"DTP",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("DEP ELG DTP",AGEVHDA,AGEVADA)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,"DTP",AGEVADA,0)),U)
 .. S $P(AGEV("DEP ELG DTP",AGEVHDA,AGEVADA),U,2)=$P($G(^AGEVH(AGEVF,5,AGEVHDA,"DTP",AGEVADA,0)),U,2)
 ..Q
 . S AGEVADA=0
 . F  S AGEVADA=$O(^AGEVH(AGEVF,5,AGEVHDA,"MSG",AGEVADA)) Q:'AGEVADA  D
 .. S AGEV("DEP ELG MSG",AGEVHDA,AGEVADA)=$G(^AGEVH(AGEVF,5,AGEVHDA,"MSG",AGEVADA,0))
 ..Q
 .Q
 Q
 ;
TEXT ;
 ;;AGEV Eligibility Verification
 ;;
 ;;******************************
 ;;* Verify Patient Eligibility *
 ;;******************************
 ;;
 Q
 ;
HELP ; -- help code
 S X="?"
 D DISP^XQORM1
 W !!
 Q
 ;
EXIT ; -- exit code
 D EN^XBVK("AGEV")
 K ^TMP("AGEV",$J)
 K AGEVRCNT,AGEVLINE,AGEVX,AGEVP0,AGEVC,AGEVL,AGEVLR,AGEVPIEN,AGEVAF
 K AGEVPRB,AGEVOVRR,AGEVLOOK,AGEVPDFN,AGEVLOC,AGEVDATE
 K X,Y
 K VALMHDR
 Q
 ;
EXPND ; -- expand code
 Q