EASEZPVD ;ALB/AMA/CMF,LBD - GATHER VISTA DATA TO PRINT FROM DG OPTIONS ; 10/13/10 4:05pm
;;1.0;ENROLLMENT APPLICATION SYSTEM;**57,66,70,81,92**;Mar 15, 2001;Build 20
;
VISTA(EASDFN,EASMTIEN) ;GATHER VISTA DATA -- CALLED FROM EN^EASEZPDG
; INPUT:
; EASDFN - POINTER TO PATIENT FILE (#2)
; EASMTIEN - MeansTestIEN (408.31)
;
N X,KEY,VDATA,DISPOS,DGNT,ENROLL,RACE,ETHNC
;
;GET LAST ALIAS NAME
S X=$O(^DPT(EASDFN,.01,""),-1)
I +X D
. S KEY=+$$KEY711^EASEZU1("APPLICANT OTHER NAME")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.01^.01")
. Q:VDATA=-1 Q:VDATA=""
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;
;GATHER MOST RECENT DISPOSITION DATA, IF IT EXISTS
;OTHERWISE, PRINT "UNKNOWN" FOR THE FOLLOWING FIELDS
D I2101^EASEZI(EASDFN,.DISPOS)
I $D(DISPOS),$D(DISPOS(1)) I DISPOS(1)="NO DISPOSITION" Q
I $D(DISPOS)>1 D I 1
. ;GET TYPE OF BENEFIT
. S VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^2")
. I (VDATA'=-1),(VDATA'="") D
. . I (VDATA="HOSPITAL")!(VDATA="OUTPATIENT MEDICAL") S VDATA="HEALTH SERVICES"
. . I VDATA["DENTAL" S VDATA="DENTAL"
. . I VDATA["NURSING" S VDATA="NURSING HOME"
. . S KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-"_VDATA)
. . S ^TMP("EZDATA",$J,KEY,1,2)="YES"
. ;GET FACILITY APPLYING TO
. S KEY=+$$KEY711^EASEZU1("FACILITY TO RECEIVE 1010EZ")
. S VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^3")
. I (VDATA'=-1),(VDATA'="") S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. ;
. ;GET NEED RELATED TO JOB INJURY OR ACCIDENT
. S KEY=+$$KEY711^EASEZU1("NEED RELATED TO JOB INJURY")
. S VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^20")
. I (VDATA'=-1),(VDATA'="") S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. S KEY=+$$KEY711^EASEZU1("NEED RELATED TO ACCIDENT")
. S VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^23")
. I (VDATA'=-1),(VDATA'="") S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
E D
. ;IF NO DISPOSITION DATA, PRINT "UNKNOWN" FOR ABOVE FIELDS
. S KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-HEALTH SERVICES")
. S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
. S KEY=+$$KEY711^EASEZU1("FACILITY TO RECEIVE 1010EZ")
. S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
. S KEY=+$$KEY711^EASEZU1("NEED RELATED TO JOB INJURY")
. S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
. S KEY=+$$KEY711^EASEZU1("NEED RELATED TO ACCIDENT")
. S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
;
;GET DATA FROM FILE #2
S KEY=0 F S KEY=$O(^TMP("EZDATA",$J,KEY)) Q:'KEY D
. S X=^TMP("EZDATA",$J,KEY)
. I $P(X,U,1,2)="2^2" D
. . S VDATA=$$GET^EASEZC1(EASDFN,X)
. . Q:VDATA=-1 Q:VDATA=""
. . I $P(X,U,3)=.09 S VDATA=$$SSNOUT^EASEZT1(VDATA)
. . I $P(X,U,3)=.117 D
. . . N ST,CNTY,CNAME
. . . S ST=$$GET1^DIQ(2,EASDFN,.115,"I")
. . . S CNTY=$$GET1^DIQ(2,EASDFN,.117,"I")
. . . S CNAME=$$GET1^DIQ(5.01,CNTY_","_ST,.01)
. . . S VDATA=CNAME_" ("_VDATA_")"
. . ;EAS*1.0*70
. . I $P(X,U,3)=.1173 S VDATA=$$COUNTRY^EASEZT1(VDATA) Q:VDATA=-1
. . I $P(X,U,3)=.3405 D
. . . I VDATA="N" S VDATA="EMERGENCY CONTACT"
. . . E S VDATA="NEXT OF KIN"
. . I $P(X,U,3)=.362 D
. . . I VDATA'["IN LIEU OF" S VDATA="NO"
. . . E S VDATA="YES"
. . S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;CONVERT ANSWERS FOR SPINAL CORD INJURY
S KEY=+$$KEY711^EASEZU1("SPINAL CORD INJURY")
S VDATA=$$GET^EASEZC1(EASDFN,"2^2^57.4") D
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN" Q
. I VDATA="NOT APPLICABLE" S VDATA="NO" Q
. S VDATA="YES"
S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;IF PURPLE HEART OR NOSE/THROAT RADIUM UNANSWERED, SET TO "UNKNOWN"
S KEY=+$$KEY711^EASEZU1("PURPLE HEART")
S VDATA=$G(^TMP("EZDATA",$J,KEY,1,2))
I (VDATA=-1)!(VDATA="") S ^TMP("EZDATA",$J,KEY,1,2)="UNKNOWN"
S KEY=+$$KEY711^EASEZU1("NOSE/THROAT RADIUM")
S X=$$GETCUR^DGNTAPI(EASDFN,"DGNT")
S VDATA=$E($G(DGNT("INTRP")))
I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
I (VDATA'=-1),(VDATA'="") S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;
;GET LAST MILITARY SERVICE EPISODE DATA FROM MSE SUB-FILE #2.3216
;DG*5.3*797
I '$D(^DPT(EASDFN,.3216)) D MOVMSE^DGMSEUTL(EASDFN)
S X=$O(^DPT(EASDFN,.3216,"B",""),-1) S:X X=$O(^DPT(EASDFN,.3216,"B",X,""))
I +X D
. S KEY=+$$KEY711^EASEZU1("LAST ENTRY DATE")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.01")
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. S KEY=+$$KEY711^EASEZU1("LAST DISCHARGE DATE")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.02")
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. S KEY=+$$KEY711^EASEZU1("LAST BRANCH OF SERVICE")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.03")
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. S KEY=+$$KEY711^EASEZU1("SERVICE NUMBER")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.05")
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
. S KEY=+$$KEY711^EASEZU1("LAST DISCHARGE TYPE")
. S VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.06")
. I (VDATA=-1)!(VDATA="") S VDATA="UNKNOWN"
. S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;
;GET ENROLLMENT DATA
D I2711^EASEZI(EASDFN,.ENROLL)
I $D(ENROLL)>1 D
. S VDATA="" D ENR^EASEZC1(ENROLL(1),.VDATA)
. Q:VDATA=-1 Q:VDATA=""
. S ^TMP("EZDATA",$J,C2711,1,2)=VDATA
;
;GET DATA FROM FILES 408.12, 408.13, 408.21, AND 408.22
D V408^EASEZPV2(EASDFN,EASMTIEN)
;
;GET RACE DATA
D I202^EASEZI(EASDFN,.RACE)
I $D(RACE)>1 D
. N SBIEN
. S X=0 F S X=$O(RACE(X)) Q:'X D
. . S SBIEN=$P(RACE(X),";",2)
. . S VDATA=$$GET1^DIQ(2.02,SBIEN_","_EASDFN,.01)
. . Q:VDATA=-1 Q:VDATA=""
. . S KEY=+$$KEY711^EASEZU1("APPLICANT RACE - "_VDATA)
. . S ^TMP("EZDATA",$J,KEY,1,2)="YES"
;
;GET ETHNICITY DATA
D I206^EASEZI(EASDFN,.ETHNC)
I $D(ETHNC)>1 D
. N SBIEN
. S X=0 F S X=$O(ETHNC(X)) Q:'X D
. . S SBIEN=$P(ETHNC(X),";",2)
. . S VDATA=$$GET1^DIQ(2.06,SBIEN_","_EASDFN,.01)
. . Q:VDATA=-1 Q:VDATA=""
. . Q:$E(VDATA,1,8)="DECLINED"
. . I VDATA="HISPANIC OR LATINO" S VDATA="YES"
. . I $E(VDATA,1,3)="NOT" S VDATA="NO"
. . I $E(VDATA,1,3)="UNK" S VDATA="UNKNOWN"
. . S KEY=+$$KEY711^EASEZU1("APPLICANT SPANISH, HISPANIC, OR LATIN")
. . S ^TMP("EZDATA",$J,KEY,1,2)=VDATA
;
;GET INSURANCE DATA
D INSUR^EASEZPVI(EASDFN)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEASEZPVD 6203 printed Oct 16, 2024@17:55:46 Page 2
EASEZPVD ;ALB/AMA/CMF,LBD - GATHER VISTA DATA TO PRINT FROM DG OPTIONS ; 10/13/10 4:05pm
+1 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**57,66,70,81,92**;Mar 15, 2001;Build 20
+2 ;
VISTA(EASDFN,EASMTIEN) ;GATHER VISTA DATA -- CALLED FROM EN^EASEZPDG
+1 ; INPUT:
+2 ; EASDFN - POINTER TO PATIENT FILE (#2)
+3 ; EASMTIEN - MeansTestIEN (408.31)
+4 ;
+5 NEW X,KEY,VDATA,DISPOS,DGNT,ENROLL,RACE,ETHNC
+6 ;
+7 ;GET LAST ALIAS NAME
+8 SET X=$ORDER(^DPT(EASDFN,.01,""),-1)
+9 IF +X
Begin DoDot:1
+10 SET KEY=+$$KEY711^EASEZU1("APPLICANT OTHER NAME")
+11 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.01^.01")
+12 if VDATA=-1
QUIT
if VDATA=""
QUIT
+13 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
End DoDot:1
+14 ;
+15 ;GATHER MOST RECENT DISPOSITION DATA, IF IT EXISTS
+16 ;OTHERWISE, PRINT "UNKNOWN" FOR THE FOLLOWING FIELDS
+17 DO I2101^EASEZI(EASDFN,.DISPOS)
+18 IF $DATA(DISPOS)
IF $DATA(DISPOS(1))
IF DISPOS(1)="NO DISPOSITION"
QUIT
+19 IF $DATA(DISPOS)>1
Begin DoDot:1
+20 ;GET TYPE OF BENEFIT
+21 SET VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^2")
+22 IF (VDATA'=-1)
IF (VDATA'="")
Begin DoDot:2
+23 IF (VDATA="HOSPITAL")!(VDATA="OUTPATIENT MEDICAL")
SET VDATA="HEALTH SERVICES"
+24 IF VDATA["DENTAL"
SET VDATA="DENTAL"
+25 IF VDATA["NURSING"
SET VDATA="NURSING HOME"
+26 SET KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-"_VDATA)
+27 SET ^TMP("EZDATA",$JOB,KEY,1,2)="YES"
End DoDot:2
+28 ;GET FACILITY APPLYING TO
+29 SET KEY=+$$KEY711^EASEZU1("FACILITY TO RECEIVE 1010EZ")
+30 SET VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^3")
+31 IF (VDATA'=-1)
IF (VDATA'="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+32 ;
+33 ;GET NEED RELATED TO JOB INJURY OR ACCIDENT
+34 SET KEY=+$$KEY711^EASEZU1("NEED RELATED TO JOB INJURY")
+35 SET VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^20")
+36 IF (VDATA'=-1)
IF (VDATA'="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+37 SET KEY=+$$KEY711^EASEZU1("NEED RELATED TO ACCIDENT")
+38 SET VDATA=$$GET^EASEZC1(DISPOS(1),"2^2.101^23")
+39 IF (VDATA'=-1)
IF (VDATA'="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
End DoDot:1
IF 1
+40 IF '$TEST
Begin DoDot:1
+41 ;IF NO DISPOSITION DATA, PRINT "UNKNOWN" FOR ABOVE FIELDS
+42 SET KEY=+$$KEY711^EASEZU1("TYPE OF BENEFIT-HEALTH SERVICES")
+43 SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
+44 SET KEY=+$$KEY711^EASEZU1("FACILITY TO RECEIVE 1010EZ")
+45 SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
+46 SET KEY=+$$KEY711^EASEZU1("NEED RELATED TO JOB INJURY")
+47 SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
+48 SET KEY=+$$KEY711^EASEZU1("NEED RELATED TO ACCIDENT")
+49 SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
End DoDot:1
+50 ;
+51 ;GET DATA FROM FILE #2
+52 SET KEY=0
FOR
SET KEY=$ORDER(^TMP("EZDATA",$JOB,KEY))
if 'KEY
QUIT
Begin DoDot:1
+53 SET X=^TMP("EZDATA",$JOB,KEY)
+54 IF $PIECE(X,U,1,2)="2^2"
Begin DoDot:2
+55 SET VDATA=$$GET^EASEZC1(EASDFN,X)
+56 if VDATA=-1
QUIT
if VDATA=""
QUIT
+57 IF $PIECE(X,U,3)=.09
SET VDATA=$$SSNOUT^EASEZT1(VDATA)
+58 IF $PIECE(X,U,3)=.117
Begin DoDot:3
+59 NEW ST,CNTY,CNAME
+60 SET ST=$$GET1^DIQ(2,EASDFN,.115,"I")
+61 SET CNTY=$$GET1^DIQ(2,EASDFN,.117,"I")
+62 SET CNAME=$$GET1^DIQ(5.01,CNTY_","_ST,.01)
+63 SET VDATA=CNAME_" ("_VDATA_")"
End DoDot:3
+64 ;EAS*1.0*70
+65 IF $PIECE(X,U,3)=.1173
SET VDATA=$$COUNTRY^EASEZT1(VDATA)
if VDATA=-1
QUIT
+66 IF $PIECE(X,U,3)=.3405
Begin DoDot:3
+67 IF VDATA="N"
SET VDATA="EMERGENCY CONTACT"
+68 IF '$TEST
SET VDATA="NEXT OF KIN"
End DoDot:3
+69 IF $PIECE(X,U,3)=.362
Begin DoDot:3
+70 IF VDATA'["IN LIEU OF"
SET VDATA="NO"
+71 IF '$TEST
SET VDATA="YES"
End DoDot:3
+72 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
End DoDot:2
End DoDot:1
+73 ;CONVERT ANSWERS FOR SPINAL CORD INJURY
+74 SET KEY=+$$KEY711^EASEZU1("SPINAL CORD INJURY")
+75 SET VDATA=$$GET^EASEZC1(EASDFN,"2^2^57.4")
Begin DoDot:1
+76 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
QUIT
+77 IF VDATA="NOT APPLICABLE"
SET VDATA="NO"
QUIT
+78 SET VDATA="YES"
End DoDot:1
+79 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+80 ;IF PURPLE HEART OR NOSE/THROAT RADIUM UNANSWERED, SET TO "UNKNOWN"
+81 SET KEY=+$$KEY711^EASEZU1("PURPLE HEART")
+82 SET VDATA=$GET(^TMP("EZDATA",$JOB,KEY,1,2))
+83 IF (VDATA=-1)!(VDATA="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)="UNKNOWN"
+84 SET KEY=+$$KEY711^EASEZU1("NOSE/THROAT RADIUM")
+85 SET X=$$GETCUR^DGNTAPI(EASDFN,"DGNT")
+86 SET VDATA=$EXTRACT($GET(DGNT("INTRP")))
+87 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+88 IF (VDATA'=-1)
IF (VDATA'="")
SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+89 ;
+90 ;GET LAST MILITARY SERVICE EPISODE DATA FROM MSE SUB-FILE #2.3216
+91 ;DG*5.3*797
+92 IF '$DATA(^DPT(EASDFN,.3216))
DO MOVMSE^DGMSEUTL(EASDFN)
+93 SET X=$ORDER(^DPT(EASDFN,.3216,"B",""),-1)
if X
SET X=$ORDER(^DPT(EASDFN,.3216,"B",X,""))
+94 IF +X
Begin DoDot:1
+95 SET KEY=+$$KEY711^EASEZU1("LAST ENTRY DATE")
+96 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.01")
+97 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+98 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+99 SET KEY=+$$KEY711^EASEZU1("LAST DISCHARGE DATE")
+100 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.02")
+101 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+102 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+103 SET KEY=+$$KEY711^EASEZU1("LAST BRANCH OF SERVICE")
+104 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.03")
+105 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+106 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+107 SET KEY=+$$KEY711^EASEZU1("SERVICE NUMBER")
+108 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.05")
+109 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+110 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
+111 SET KEY=+$$KEY711^EASEZU1("LAST DISCHARGE TYPE")
+112 SET VDATA=$$GET^EASEZC1(EASDFN_";"_+X,"2^2.3216^.06")
+113 IF (VDATA=-1)!(VDATA="")
SET VDATA="UNKNOWN"
+114 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
End DoDot:1
+115 ;
+116 ;GET ENROLLMENT DATA
+117 DO I2711^EASEZI(EASDFN,.ENROLL)
+118 IF $DATA(ENROLL)>1
Begin DoDot:1
+119 SET VDATA=""
DO ENR^EASEZC1(ENROLL(1),.VDATA)
+120 if VDATA=-1
QUIT
if VDATA=""
QUIT
+121 SET ^TMP("EZDATA",$JOB,C2711,1,2)=VDATA
End DoDot:1
+122 ;
+123 ;GET DATA FROM FILES 408.12, 408.13, 408.21, AND 408.22
+124 DO V408^EASEZPV2(EASDFN,EASMTIEN)
+125 ;
+126 ;GET RACE DATA
+127 DO I202^EASEZI(EASDFN,.RACE)
+128 IF $DATA(RACE)>1
Begin DoDot:1
+129 NEW SBIEN
+130 SET X=0
FOR
SET X=$ORDER(RACE(X))
if 'X
QUIT
Begin DoDot:2
+131 SET SBIEN=$PIECE(RACE(X),";",2)
+132 SET VDATA=$$GET1^DIQ(2.02,SBIEN_","_EASDFN,.01)
+133 if VDATA=-1
QUIT
if VDATA=""
QUIT
+134 SET KEY=+$$KEY711^EASEZU1("APPLICANT RACE - "_VDATA)
+135 SET ^TMP("EZDATA",$JOB,KEY,1,2)="YES"
End DoDot:2
End DoDot:1
+136 ;
+137 ;GET ETHNICITY DATA
+138 DO I206^EASEZI(EASDFN,.ETHNC)
+139 IF $DATA(ETHNC)>1
Begin DoDot:1
+140 NEW SBIEN
+141 SET X=0
FOR
SET X=$ORDER(ETHNC(X))
if 'X
QUIT
Begin DoDot:2
+142 SET SBIEN=$PIECE(ETHNC(X),";",2)
+143 SET VDATA=$$GET1^DIQ(2.06,SBIEN_","_EASDFN,.01)
+144 if VDATA=-1
QUIT
if VDATA=""
QUIT
+145 if $EXTRACT(VDATA,1,8)="DECLINED"
QUIT
+146 IF VDATA="HISPANIC OR LATINO"
SET VDATA="YES"
+147 IF $EXTRACT(VDATA,1,3)="NOT"
SET VDATA="NO"
+148 IF $EXTRACT(VDATA,1,3)="UNK"
SET VDATA="UNKNOWN"
+149 SET KEY=+$$KEY711^EASEZU1("APPLICANT SPANISH, HISPANIC, OR LATIN")
+150 SET ^TMP("EZDATA",$JOB,KEY,1,2)=VDATA
End DoDot:2
End DoDot:1
+151 ;
+152 ;GET INSURANCE DATA
+153 DO INSUR^EASEZPVI(EASDFN)
+154 QUIT