EASEZPVI ;ALB/AMA,ERC,SCK,LBD; GATHER VISTA INSURANCE DATA TO PRINT FROM DG OPTIONS ; 10/29/12 1:07pm
;;1.0;ENROLLMENT APPLICATION SYSTEM;**57,70,103,107**;Mar 15, 2001;Build 32
;
Q
;
INSUR(EASDFN) ;GET INSURANCE DATA
; INPUT:
; EASDFN - POINTER TO THE PATIENT FILE
;
;IF THEY EXIST, FIND INSURANCE COMPANY NAME(S), ADDRESS,
;CITY, STATE, ZIP, PHONE, GROUP CODE(S), POLICY NUMBER(S),
;NAME(S) OF INSURED, MEDICARE PART A/B, AND EFFECTIVE DATE(S)
;
; 103 - MODIFY THE GETS^DIQ TO RETRIEVE ONLY NEEDED DATA ELEMENTS TO REDUCE THE THE LARGE NUMBER
; OF ELIGIBILITY/BENEFIT SUB-MULTIPLES THAT ARE BEING RETURNED.
;
N KEY,VDATA,MULTIPLE,INDA,IENS,INSUR,INSORT,FLD,TYPE,IEN,INPTR,NAME
N STREET,CITY,STPTR,STATE,ZIP,PHONE,GRPCD,POLNO,INNAME,KEYNM,M,CAT,GRPTR
S KEY=+$$KEY711^EASEZU1("APPLICANT HAS INSURANCE")
S VDATA=$$GET^EASEZC1(EASDFN,"2^2^.3192")
I (VDATA=-1)!(VDATA="") S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
I (VDATA'=-1),(VDATA'="") S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
Q:VDATA'="YES"
;
S MULTIPLE=0
S INDA=0 F S INDA=$O(^DPT(EASDFN,.312,INDA)) Q:'INDA D
. D GETS^DIQ(2.312,INDA_","_EASDFN,".01;1.09;1;3;17;.18;21;8","IE","INSUR")
S IENS="" F S IENS=$O(INSUR(2.312,IENS)) Q:IENS="" D
. S FLD=0 F S FLD=$O(INSUR(2.312,IENS,FLD)) Q:'FLD D
. . F TYPE="E","I" S INSORT(2.312,+IENS,FLD,TYPE)=$G(INSUR(2.312,IENS,FLD,TYPE))
K INSUR
S IEN=0 F S IEN=$O(INSORT(2.312,IEN)) Q:'IEN D
. Q:'$G(INSORT(2.312,IEN,.18,"I"))
. S GRPTR=INSORT(2.312,IEN,.18,"I") ;PTR TO GROUP PLAN FILE (#355.3)
. Q:$$GET1^DIQ(355.3,GRPTR,.11,"I") ;INACTIVE FLAG
. I DT'>$G(INSORT(2.312,IEN,3,"I")) Q ;INSUR EXPIRATION DATE
. ;Set INPTR to pointer to INSURANCE COMPANY file (#36) - EAS*1*107
. S INPTR=$G(INSORT(2.312,IEN,.01,"I")) Q:'INPTR
. S NAME=$G(INSORT(2.312,IEN,.18,"E"))
. S STREET=$$GET1^DIQ(36,INPTR,.111),CITY=$$GET1^DIQ(36,INPTR,.114)
. S STPTR=$$GET1^DIQ(36,INPTR,.115,"I"),STATE=$$GET1^DIQ(5,STPTR,1)
. S ZIP=$$GET1^DIQ(36,INPTR,.116),PHONE=$$GET1^DIQ(36,INPTR,.131)
. S GRPCD=$$GET1^DIQ(355.3,GRPTR,.04),POLNO=$G(INSORT(2.312,IEN,1,"E"))
. S INNAME=$G(INSORT(2.312,IEN,17,"E"))
. S MULTIPLE=MULTIPLE+1
. I MULTIPLE=1 S KEYNM="APPLICANT",M=1
. E S KEYNM="OTHER(N)",M=MULTIPLE-1
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE COMPANY")
. I NAME]"" S ^TMP("EZDATA",$J,KEY,M,2)=NAME
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE ADDRESS")
. I STREET]"" S ^TMP("EZDATA",$J,KEY,M,2)=STREET
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE CITY")
. I CITY]"" S ^TMP("EZDATA",$J,KEY,M,2)=CITY
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE STATE")
. I STATE]"" S ^TMP("EZDATA",$J,KEY,M,2)=STATE
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE ZIP")
. I ZIP]"" S ^TMP("EZDATA",$J,KEY,M,2)=ZIP
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE PHONE NUMBER")
. I PHONE]"" S ^TMP("EZDATA",$J,KEY,M,2)=PHONE
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE GROUP CODE")
. I GRPCD]"" S ^TMP("EZDATA",$J,KEY,M,2)=GRPCD
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE POLICY HOLDER")
. I INNAME]"" S ^TMP("EZDATA",$J,KEY,M,2)=INNAME
. S KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE POLICY NUMBER")
. I POLNO]"" S ^TMP("EZDATA",$J,KEY,M,2)=POLNO
. ;
. I $$GET^EASEZC1(GRPTR,"355.3^355.3^.09")="MEDICARE (M)" D
. . S CAT=$$GET^EASEZC1(GRPTR,"355.3^355.3^.14")
. . I (CAT'="MEDICARE PART A"),(CAT'="MEDICARE PART B") Q
. . S KEY=+$$KEY711^EASEZU1(CAT)
. . S ^TMP("EZDATA",$J,KEY,M,2)="YES"
. . S VDATA=$$GET^EASEZC1(EASDFN_";"_INDA,"2^2.312^8")
. . Q:VDATA="" Q:VDATA=-1
. . S KEY=+$$KEY711^EASEZU1(CAT_" EFFECTIVE DATE")
. . S ^TMP("EZDATA",$J,KEY,M,2)=VDATA
;
Q
;
I408(EASDFN,MTDT,EASARRAY) ;retrieve ien(s) to files #408.12,#408.13,#408.21,#408.22
; Modified from I408^EASEZI, called from V408^EASEZPV2
;input EASDFN = ien to #2
; MTDT = Means Test date
;output EASARRAY = ien(s) to files; passed by reference
; array(408,"V",1) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;veteran data
; array(408,"S",1) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;spouse data
; array(408,"C",multiple) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;child data
;where ien_#408.13 = ien;global_root
;
N Y,%F,X,%DT,MTDATE
N SUB1,SUB2,INCYR,DGINC,DGREL,DGINR
N I21,I22
;
Q:'EASDFN
S Y=MTDT,%F=5,X=$$FMTE^XLFDT(Y,%F),X=+$P(X,"/",3)-1,%DT="P"
D ^%DT S MTDATE=Y
;retrieve all associated 408 records; refer to api call for docu
I MTDT D ALL^DGMTU21(EASDFN,"VSC",MTDT)
;massage "V" and "S" nodes for clear use in for loop below
S:$D(DGINC("V")) DGINC("V",1)=DGINC("V")
S:$D(DGINR("V")) DGINR("V",1)=DGINR("V")
S:$D(DGREL("V")) DGREL("V",1)=DGREL("V")
S:$D(DGINC("S")) DGINC("S",1)=DGINC("S")
S:$D(DGINR("S")) DGINR("S",1)=DGINR("S")
S:$D(DGREL("S")) DGREL("S",1)=DGREL("S")
;
F SUB1="V","S","C" D
. Q:'$D(DGREL(SUB1))
. S SUB2=0
. F S SUB2=$O(DGREL(SUB1,SUB2)) Q:'SUB2 D
. . S EASARRAY(408,SUB1,SUB2)=DGREL(SUB1,SUB2)
. . S I21=$G(DGINC(SUB1,SUB2)) ; 408.21 ien
. . Q:'I21
. . S INCYR=$$GET1^DIQ(408.21,I21_",",.01,"I")
. . ;NOTE: The following two quit conditions are probably not
. . ; not necessary given the arrays being returned from
. . ; ALL^DGMTU21
. . Q:'MTDT
. . Q:(INCYR<MTDATE)
. . S I22=$G(DGINR(SUB1,SUB2)) ;408.22 ien
. . Q:$G(^DGMT(408.22,+I22,"MT"))=""
. . ;
. . S EASARRAY(408,SUB1,SUB2)=EASARRAY(408,SUB1,SUB2)_U_I21_U_I22
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEASEZPVI 5466 printed Oct 16, 2024@17:55:47 Page 2
EASEZPVI ;ALB/AMA,ERC,SCK,LBD; GATHER VISTA INSURANCE DATA TO PRINT FROM DG OPTIONS ; 10/29/12 1:07pm
+1 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**57,70,103,107**;Mar 15, 2001;Build 32
+2 ;
+3 QUIT
+4 ;
INSUR(EASDFN) ;GET INSURANCE DATA
+1 ; INPUT:
+2 ; EASDFN - POINTER TO THE PATIENT FILE
+3 ;
+4 ;IF THEY EXIST, FIND INSURANCE COMPANY NAME(S), ADDRESS,
+5 ;CITY, STATE, ZIP, PHONE, GROUP CODE(S), POLICY NUMBER(S),
+6 ;NAME(S) OF INSURED, MEDICARE PART A/B, AND EFFECTIVE DATE(S)
+7 ;
+8 ; 103 - MODIFY THE GETS^DIQ TO RETRIEVE ONLY NEEDED DATA ELEMENTS TO REDUCE THE THE LARGE NUMBER
+9 ; OF ELIGIBILITY/BENEFIT SUB-MULTIPLES THAT ARE BEING RETURNED.
+10 ;
+11 NEW KEY,VDATA,MULTIPLE,INDA,IENS,INSUR,INSORT,FLD,TYPE,IEN,INPTR,NAME
+12 NEW STREET,CITY,STPTR,STATE,ZIP,PHONE,GRPCD,POLNO,INNAME,KEYNM,M,CAT,GRPTR
+13 SET KEY=+$$KEY711^EASEZU1("APPLICANT HAS INSURANCE")
+14 SET VDATA=$$GET^EASEZC1(EASDFN,"2^2^.3192")
+15 IF (VDATA=-1)!(VDATA="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
+16 IF (VDATA'=-1)
IF (VDATA'="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+17 if VDATA'="YES"
QUIT
+18 ;
+19 SET MULTIPLE=0
+20 SET INDA=0
FOR
SET INDA=$ORDER(^DPT(EASDFN,.312,INDA))
if 'INDA
QUIT
Begin DoDot:1
+21 DO GETS^DIQ(2.312,INDA_","_EASDFN,".01;1.09;1;3;17;.18;21;8","IE","INSUR")
End DoDot:1
+22 SET IENS=""
FOR
SET IENS=$ORDER(INSUR(2.312,IENS))
if IENS=""
QUIT
Begin DoDot:1
+23 SET FLD=0
FOR
SET FLD=$ORDER(INSUR(2.312,IENS,FLD))
if 'FLD
QUIT
Begin DoDot:2
+24 FOR TYPE="E","I"
SET INSORT(2.312,+IENS,FLD,TYPE)=$GET(INSUR(2.312,IENS,FLD,TYPE))
End DoDot:2
End DoDot:1
+25 KILL INSUR
+26 SET IEN=0
FOR
SET IEN=$ORDER(INSORT(2.312,IEN))
if 'IEN
QUIT
Begin DoDot:1
+27 if '$GET(INSORT(2.312,IEN,.18,"I"))
QUIT
+28 ;PTR TO GROUP PLAN FILE (#355.3)
SET GRPTR=INSORT(2.312,IEN,.18,"I")
+29 ;INACTIVE FLAG
if $$GET1^DIQ(355.3,GRPTR,.11,"I")
QUIT
+30 ;INSUR EXPIRATION DATE
IF DT'>$GET(INSORT(2.312,IEN,3,"I"))
QUIT
+31 ;Set INPTR to pointer to INSURANCE COMPANY file (#36) - EAS*1*107
+32 SET INPTR=$GET(INSORT(2.312,IEN,.01,"I"))
if 'INPTR
QUIT
+33 SET NAME=$GET(INSORT(2.312,IEN,.18,"E"))
+34 SET STREET=$$GET1^DIQ(36,INPTR,.111)
SET CITY=$$GET1^DIQ(36,INPTR,.114)
+35 SET STPTR=$$GET1^DIQ(36,INPTR,.115,"I")
SET STATE=$$GET1^DIQ(5,STPTR,1)
+36 SET ZIP=$$GET1^DIQ(36,INPTR,.116)
SET PHONE=$$GET1^DIQ(36,INPTR,.131)
+37 SET GRPCD=$$GET1^DIQ(355.3,GRPTR,.04)
SET POLNO=$GET(INSORT(2.312,IEN,1,"E"))
+38 SET INNAME=$GET(INSORT(2.312,IEN,17,"E"))
+39 SET MULTIPLE=MULTIPLE+1
+40 IF MULTIPLE=1
SET KEYNM="APPLICANT"
SET M=1
+41 IF '$TEST
SET KEYNM="OTHER(N)"
SET M=MULTIPLE-1
+42 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE COMPANY")
+43 IF NAME]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=NAME
+44 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE ADDRESS")
+45 IF STREET]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=STREET
+46 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE CITY")
+47 IF CITY]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=CITY
+48 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE STATE")
+49 IF STATE]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=STATE
+50 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE ZIP")
+51 IF ZIP]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=ZIP
+52 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE PHONE NUMBER")
+53 IF PHONE]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=PHONE
+54 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE GROUP CODE")
+55 IF GRPCD]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=GRPCD
+56 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE POLICY HOLDER")
+57 IF INNAME]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=INNAME
+58 SET KEY=+$$KEY711^EASEZU1(KEYNM_" INSURANCE POLICY NUMBER")
+59 IF POLNO]""
SET ^TMP("EZDATA",$JOB,KEY,M,2)=POLNO
+60 ;
+61 IF $$GET^EASEZC1(GRPTR,"355.3^355.3^.09")="MEDICARE (M)"
Begin DoDot:2
+62 SET CAT=$$GET^EASEZC1(GRPTR,"355.3^355.3^.14")
+63 IF (CAT'="MEDICARE PART A")
IF (CAT'="MEDICARE PART B")
QUIT
+64 SET KEY=+$$KEY711^EASEZU1(CAT)
+65 SET ^TMP("EZDATA",$JOB,KEY,M,2)="YES"
+66 SET VDATA=$$GET^EASEZC1(EASDFN_";"_INDA,"2^2.312^8")
+67 if VDATA=""
QUIT
if VDATA=-1
QUIT
+68 SET KEY=+$$KEY711^EASEZU1(CAT_" EFFECTIVE DATE")
+69 SET ^TMP("EZDATA",$JOB,KEY,M,2)=VDATA
End DoDot:2
End DoDot:1
+70 ;
+71 QUIT
+72 ;
I408(EASDFN,MTDT,EASARRAY) ;retrieve ien(s) to files #408.12,#408.13,#408.21,#408.22
+1 ; Modified from I408^EASEZI, called from V408^EASEZPV2
+2 ;input EASDFN = ien to #2
+3 ; MTDT = Means Test date
+4 ;output EASARRAY = ien(s) to files; passed by reference
+5 ; array(408,"V",1) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;veteran data
+6 ; array(408,"S",1) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;spouse data
+7 ; array(408,"C",multiple) = ien_#408.12^ien_#408.13^ien_#408.21^ien#408.22 ;child data
+8 ;where ien_#408.13 = ien;global_root
+9 ;
+10 NEW Y,%F,X,%DT,MTDATE
+11 NEW SUB1,SUB2,INCYR,DGINC,DGREL,DGINR
+12 NEW I21,I22
+13 ;
+14 if 'EASDFN
QUIT
+15 SET Y=MTDT
SET %F=5
SET X=$$FMTE^XLFDT(Y,%F)
SET X=+$PIECE(X,"/",3)-1
SET %DT="P"
+16 DO ^%DT
SET MTDATE=Y
+17 ;retrieve all associated 408 records; refer to api call for docu
+18 IF MTDT
DO ALL^DGMTU21(EASDFN,"VSC",MTDT)
+19 ;massage "V" and "S" nodes for clear use in for loop below
+20 if $DATA(DGINC("V"))
SET DGINC("V",1)=DGINC("V")
+21 if $DATA(DGINR("V"))
SET DGINR("V",1)=DGINR("V")
+22 if $DATA(DGREL("V"))
SET DGREL("V",1)=DGREL("V")
+23 if $DATA(DGINC("S"))
SET DGINC("S",1)=DGINC("S")
+24 if $DATA(DGINR("S"))
SET DGINR("S",1)=DGINR("S")
+25 if $DATA(DGREL("S"))
SET DGREL("S",1)=DGREL("S")
+26 ;
+27 FOR SUB1="V","S","C"
Begin DoDot:1
+28 if '$DATA(DGREL(SUB1))
QUIT
+29 SET SUB2=0
+30 FOR
SET SUB2=$ORDER(DGREL(SUB1,SUB2))
if 'SUB2
QUIT
Begin DoDot:2
+31 SET EASARRAY(408,SUB1,SUB2)=DGREL(SUB1,SUB2)
+32 ; 408.21 ien
SET I21=$GET(DGINC(SUB1,SUB2))
+33 if 'I21
QUIT
+34 SET INCYR=$$GET1^DIQ(408.21,I21_",",.01,"I")
+35 ;NOTE: The following two quit conditions are probably not
+36 ; not necessary given the arrays being returned from
+37 ; ALL^DGMTU21
+38 if 'MTDT
QUIT
+39 if (INCYR<MTDATE)
QUIT
+40 ;408.22 ien
SET I22=$GET(DGINR(SUB1,SUB2))
+41 if $GET(^DGMT(408.22,+I22,"MT"))=""
QUIT
+42 ;
+43 SET EASARRAY(408,SUB1,SUB2)=EASARRAY(408,SUB1,SUB2)_U_I21_U_I22
End DoDot:2
End DoDot:1
+44 QUIT
+45 ;