XUSNPIX4 ;OAK_BP/CMW/SLT - NPI EXTRACT REPORT ;7/7/08 17:39
;;8.0;KERNEL;**438,452,453,481,528,548**; Jul 10, 1995;Build 27
;;Per VHA Directive 2004-038, this routine should not be modified.
;
; Direct access to ^IBE(350.9, fields .02, 1.05, 19;.02, 19;1.01, 19;1.02, 19;1.03, 19;,1.04, 19;1.05 authorized by
; Integration Agreement #4964.
;
; NPI Extract Report
;
; Input parameter: N/A
;
; Other relevant variables:
; XUSRTN="XUSNPIX1NV" (current routine name, used for ^XTMP and ^TMP
; XUSRTN="XUSNPIX2NV" storage subscript)
; Storage Global:
; ^XTMP("XUSNPIX1VA",0) = Piece 1^Piece 2^Piece 3^Piece 4^Piece 5^Piece 6
; ^XTMP("XUSNPIX2VA",0)
; where:
; Piece 1 => Purge Date - 1 year in future
; Piece 2 => Create Date - Today
; Piece 3 => Description
; Piece 4 => Last Date Compiled
; Piece 5 => $H last run start time
; Piece 6 => $H last run completion time
;
; Entry Point - ENT called from XUSNPIX1
;
Q
;
; Individual records
TYPE1(DTTM3,SITE,XUSPROD,XUSHDR,XUSP2P) ;
N IBA0,NVIEN,XUSNPI,MAXSIZE,XUSEOL,XUSCNT
N XUSI,XUSNM,XUSNV,XLFNC,XUSIZE,XUSDT,XUSNEW
N TOTREC1
;
; Set Maximum Message Size
S MAXSIZE=300000
;
; Set end of line character
S XUSEOL="~~"
;
S XUSCNT=1,(TOTREC1,MSGCNT,XUSIZE)=0
S XUSNPI=""
F S XUSNPI=$O(^TMP("XUSNPI",$J,1,XUSNPI)) Q:'XUSNPI D
. S XUSDATA=XUSNPI
. S NVIEN=$G(^TMP("XUSNPI",$J,1,XUSNPI))
. ;
. F XUSI=1:1:33 S XUSNV(XUSI)=""
. S IBA0=$G(^IBA(355.93,NVIEN,0))
. S XUSNM=$P(IBA0,U)
. ; Break Name into components
. I XUSNM'="" D
. . S XLFNC=XUSNM D FORMAT^XLFNAME7(.XLFNC,,,,0)
. . S XUSNV(2)=XLFNC("GIVEN"),XUSNV(3)=XLFNC("MIDDLE"),XUSNV(4)=XLFNC("FAMILY")
. . I XLFNC("SUFFIX")'="" S XUSNV(4)=XUSNV(4)_" "_XLFNC("SUFFIX")
. . K XLFNC
. S XUSDATA=XUSDATA_U_XUSNV(2)_U_XUSNV(3)_U_XUSNV(4)
. S XUSNV(5)=1 ;TYPE
. ;
. ; DOB (place holder)
. S XUSNV(6)=""
. S XUSDATA=XUSDATA_U_XUSNV(5)_U_XUSNV(6)
. ;
. ; Pay to Provider Address (7-12)
. S XUSDATA=XUSDATA_U_XUSP2P
. ;
. ; Servicing Provider Address
. S XUSNV(13)=$P(IBA0,U,5)
. S XUSNV(14)=$P(IBA0,U,10)
. S XUSNV(15)=$P(IBA0,U,6)
. S XUSNV(16)=$P(IBA0,U,7)
. I XUSNV(16) S XUSNV(16)=$P($G(^DIC(5,XUSNV(16),0)),U,2)
. S XUSNV(17)=$P(IBA0,U,8)
. S XUSDATA=XUSDATA_U_XUSNV(13)_U_XUSNV(14)_U_XUSNV(15)_U_XUSNV(16)_U_XUSNV(17)
. ;
. ; Office Phone number (place holder)
. S XUSNV(18)=""
. ;
. ; Degree Description / Degree Code (place holder)
. S XUSNV(19)=""
. S XUSNV(20)=""
. ;
. ; Get Taxonomy and specialty codes
. N NVTX,NVSPC,NVTAX
. S NVTX=0
. F S NVTX=$O(^IBA(355.93,NVIEN,"TAXONOMY","B",NVTX)) Q:'NVTX D
. . S NVSPC=$P($G(^USC(8932.1,NVTX,0)),U,9)
. . ;S NVTAX=$P($G(^USC(8932.1,NVTX,0)),U,7)
. . I NVSPC'="" D
. . . I XUSNV(21)="" S XUSNV(21)=NVSPC Q
. . . S XUSNV(21)=XUSNV(21)_";"_NVSPC
. . . Q
. . Q
. ;use "B" cross ref to find primary vs non-primary code 0 (no)!1 (yes), and only "A"'s
. S NVTX=0
. F S NVTX=$O(^IBA(355.93,NVIEN,"TAXONOMY",NVTX)) Q:NVTX'?1N.N D
. . S IBA=$G(^IBA(355.93,NVIEN,"TAXONOMY",NVTX,0))
. . I $P(IBA,U,3)="A" D
. . . I $P(IBA,U,2)=1 S XUSNV(22)=$P($G(^USC(8932.1,$P(IBA,U,1),0)),U,7)
. . . I $P(IBA,U,2)=0 D
. . . . I XUSNV(23)="" S XUSNV(23)=$P($G(^USC(8932.1,$P(IBA,U,1),0)),U,7) Q
. . . . ;
. . . . ; *** Start XU*8.0*548 - RBN ***
. . . . ;
. . . . I (XUSNV(23)'[$P($G(^USC(8932.1,$P(IBA,U,1),0)),U,7))&($P($G(^USC(8932.1,$P(IBA,U,1),0)),U,7)'=XUSNV(22)) D
. . . . . S XUSNV(23)=XUSNV(23)_";"_$P($G(^USC(8932.1,$P(IBA,U,1),0)),U,7)
. . . . . ;
. . . . . ; *** End XU*8.0*548 - RBN ***
. . . . . ;
. . . . Q
. . . Q
. . Q
. K IBA
. ;
. ; Fed tax ID
. S XUSNV(24)=$P($G(IBA0),U,9)
. ;
. S XUSDATA=XUSDATA_U_XUSNV(18)_U_XUSNV(19)_U_XUSNV(20)_U_XUSNV(21)_U_XUSNV(22)
. S XUSDATA=XUSDATA_U_XUSNV(23)_U_XUSNV(24)
. ;
. ; Medicare Part A/B
. S XUSNV(25)=670899
. S XUSNV(26)="VA"_$E(SITE+10000,2,5)
. ;
. ; State Lic and DEA (place holder)
. S XUSNV(27)=""
. S XUSNV(28)=""
. ;
. ; Status and Creation/Termination Date (place holder)
. S XUSNV(29)=""
. S XUSNV(30)=""
. ; VISN Station
. S XUSNV(31)=SITE
. ;
. S XUSDATA=XUSDATA_U_XUSNV(25)_U_XUSNV(26)_U_XUSNV(27)
. S XUSDATA=XUSDATA_U_XUSNV(28)_U_XUSNV(29)_U_XUSNV(30)_U_XUSNV(31)
. ;
. ;BCBS info
. K XUSBXID
. D NNVAID^XUSNPIXU(NVIEN,.XUSBXID)
. ;
. ;Update counter and save Entry
. N XUSB,XUSB1
. S XUSCNT=XUSCNT+1,TOTREC1=TOTREC1+1
. S ^TMP(XUSRTN,$J,XUSCNT)=XUSDATA_U_XUSEOL
. S XUSIZE=XUSIZE+$L(^TMP(XUSRTN,$J,XUSCNT))
. I $D(XUSBXID) D
. . S XUSB=""
. . F S XUSB=$O(XUSBXID(XUSB)) Q:XUSB="" D
. . . S XUSB1=$G(XUSBXID(XUSB)) I XUSB1'="" S XUSB1="^"_XUSB1 ;add p 528
. . . S XUSCNT=XUSCNT+1,TOTREC1=TOTREC1+1
. . . S ^TMP(XUSRTN,$J,XUSCNT)=XUSDATA_U_$$TRIM^XLFSTR(XUSB)_XUSB1_U_XUSEOL ;add _XUSB1 p 528
. . . S XUSIZE=XUSIZE+$L(^TMP(XUSRTN,$J,XUSCNT))
. I XUSIZE>MAXSIZE D
. . D EOF1(XUSRTN)
. . D EMAIL^XUSNPIX3(XUSRTN) ;sending the extracted data via MailMan
. . K ^TMP(XUSRTN,$J)
. . S ^TMP("XUSNPIXS",$J,3,MSGCNT)="1 (Non-VA)^"_(XUSCNT-2)
. . S ^TMP(XUSRTN,$J,1)=XUSHDR
. . S XUSCNT=1,XUSIZE=0
. K XUSNV,XUSDATA,XUSBXID
;
D EOF1(XUSRTN)
;
; Send last message (if it has records)
I $G(XUSCNT)>1 D
. D EMAIL^XUSNPIX3(XUSRTN) ;sending the extracted data via MailMan
. K ^TMP(XUSRTN,$J)
. S ^TMP("XUSNPIXS",$J,3,MSGCNT)="1 (Non-VA)^"_($G(XUSCNT)-2)
;
; Update Summary
S ^XTMP("XUSNPIXT","1NV")=MSGCNT_U_TOTREC1_U_DTTM3
Q
;
EOF1(XUSRTN) ;
Q:$G(XUSCNT)=1
S MSGCNT=MSGCNT+1
S ^TMP(XUSRTN,$J,1)=XUSHDR_U_"Message Number: "_MSGCNT_U_"Line Count: "_XUSCNT_U_DTTM3_U_$G(XUSPROD)_U_XUSEOL
S XUSCNT=XUSCNT+1
S ^TMP(XUSRTN,$J,XUSCNT)="END OF FILE"_U_XUSEOL
Q
;
TYPE2(DTTM3,SITE,XUSPROD,XUSHDR,XUSP2P) ;Facility/Group
N IBA0,NVIEN,XUSNPI,MAXSIZE,XUSEOL,XUSCNT
N XUSNV,XUSI,XUSNM,XLFNC,MSGCNT,XUSIZE,XUSDT,XUSNEW,TOTREC2
;
; Set Maximum Message Size
S MAXSIZE=300000
;
; Set end of line character
S XUSEOL="~~"
;
S XUSNPI=""
S XUSCNT=1,(TOTREC2,MSGCNT,XUSIZE)=0
F S XUSNPI=$O(^TMP("XUSNPI",$J,2,XUSNPI)) Q:'XUSNPI D
. S XUSDATA=XUSNPI
. S NVIEN=$G(^TMP("XUSNPI",$J,2,XUSNPI))
. ;
. F XUSI=1:1:24 S XUSNV(XUSI)=""
. S IBA0=$G(^IBA(355.93,NVIEN,0))
. ;Get Organization name
. S XUSNV(2)=$P(IBA0,U)
. ;Type
. S XUSNV(3)=2
. ;
. S XUSDATA=XUSDATA_U_XUSNV(2)_U_XUSNV(3)
. ;
. ; Pay to Provider Address (4-9)
. S XUSDATA=XUSDATA_U_XUSP2P
. ;
. ; Servicing Provider Address
. S XUSNV(10)=$P(IBA0,U,5)
. S XUSNV(11)=$P(IBA0,U,10)
. S XUSNV(12)=$P(IBA0,U,6)
. S XUSNV(13)=$P(IBA0,U,7)
. I XUSNV(13) S XUSNV(13)=$P($G(^DIC(5,XUSNV(13),0)),U,2) ;SLT 9/23/10
. S XUSNV(14)=$P(IBA0,U,8)
. S XUSDATA=XUSDATA_U_XUSNV(10)_U_XUSNV(11)_U_XUSNV(12)_U_XUSNV(13)_U_XUSNV(14)
. ;
. ;Office Phone number (place holder)
. S XUSNV(15)=""
. ;
. ; get Taxonomy and Specialty
. N NVTX,NVSPC,NVTAX
. S NVTX=0
. F S NVTX=$O(^IBA(355.93,NVIEN,"TAXONOMY","B",NVTX)) Q:'NVTX D
. . S NVSPC=$P($G(^USC(8932.1,NVTX,0)),U,9)
. . S NVTAX=$P($G(^USC(8932.1,NVTX,0)),U,7)
. . I NVSPC'="" D
. . . I XUSNV(16)="" S XUSNV(16)=NVSPC Q
. . . S XUSNV(16)=XUSNV(16)_";"_NVSPC
. . I NVTAX'="" D
. . . I XUSNV(17)="" S XUSNV(17)=NVTAX Q
. . . ;
. . . ; *** Start XU*8.0*548 - RBN ***
. . . ;
. . . ;S XUSNV(17)=XUSNV(17)_";"_NVTAX
. . . S:(XUSNV(17)'[NVTAX) XUSNV(17)=XUSNV(17)_";"_NVTAX
. . . ;
. . . ; *** End XU*8.0*548 - RBN ***
. ;
. ; Fed Tax ID
. S XUSNV(18)=$P($G(IBA0),U,9)
. ;
. ;Medicare A/B
. S XUSNV(19)=670899
. S XUSNV(20)="VA"_$E(SITE+10000,2,5)
. ;
. S XUSDATA=XUSDATA_U_XUSNV(15)_U_XUSNV(16)_U_XUSNV(17)_U_XUSNV(18)_U_XUSNV(19)_U_XUSNV(20)
. ;
. ;State License Number
. ;S XUSNV(20)=$P($G(IBA0),U,12)
. ;
. ;DEA Number (place holder)
. S XUSNV(21)=""
. ;
. ;NCPDP #
. S XUSNV(22)=""
. ;
. ;VISN STATION ID
. S XUSNV(23)=SITE
. ;
. S XUSDATA=XUSDATA_U_XUSNV(21)_U_XUSNV(22)_U_XUSNV(23)
. ;
. ;BCBS info
. K XUSBXID
. D NNVAID^XUSNPIXU(NVIEN,.XUSBXID)
. ;
. ;Update counter and save Entry
. N XUSB,XUSB1
. S XUSCNT=XUSCNT+1,TOTREC2=TOTREC2+1
. S ^TMP(XUSRTN,$J,XUSCNT)=XUSDATA_U_XUSEOL
. S XUSIZE=XUSIZE+$L(^TMP(XUSRTN,$J,XUSCNT))
. I $D(XUSBXID) D
. . S XUSB=""
. . F S XUSB=$O(XUSBXID(XUSB)) Q:XUSB="" D
. . . S XUSB1=$G(XUSBXID(XUSB)) I XUSB1'="" S XUSB1="^"_XUSB1 ;add p 528
. . . S XUSCNT=XUSCNT+1,TOTREC2=TOTREC2+1
. . . S ^TMP(XUSRTN,$J,XUSCNT)=XUSDATA_U_$$TRIM^XLFSTR(XUSB)_XUSB1_U_XUSEOL ;add _XUSB1 p 528
. . . S XUSIZE=XUSIZE+$L(^TMP(XUSRTN,$J,XUSCNT))
. I XUSIZE>MAXSIZE D
. . D EOF2(XUSRTN)
. . D EMAIL^XUSNPIX3(XUSRTN) ;sending the extracted data via MailMan
. . K ^TMP(XUSRTN,$J)
. . S ^TMP("XUSNPIXS",$J,4,MSGCNT)="2 (Non-VA)^"_(XUSCNT-2)
. . S ^TMP(XUSRTN,$J,1)=XUSHDR
. . S XUSCNT=1,XUSIZE=0
. K XUSNV,XUSDATA,XUSB,XUSBXID
;
D EOF2(XUSRTN)
;
; Send last message (if it has records)
I $G(XUSCNT)>1 D
. D EMAIL^XUSNPIX3(XUSRTN) ;sending the extracted data via MailMan
. K ^TMP(XUSRTN,$J)
. S ^TMP("XUSNPIXS",$J,4,MSGCNT)="2 (Non-VA)^"_($G(XUSCNT)-2)
;
; Update Summary
S ^XTMP("XUSNPIXT","2NV")=MSGCNT_U_TOTREC2_U_DTTM3
Q
;
EOF2(XUSRTN) ;
Q:$G(XUSCNT)=1
S MSGCNT=MSGCNT+1
S ^TMP(XUSRTN,$J,1)=XUSHDR_U_"Message Number: "_MSGCNT_U_"Line Count: "_XUSCNT_U_DTTM3_U_$G(XUSPROD)_U_XUSEOL
S XUSCNT=XUSCNT+1
S ^TMP(XUSRTN,$J,XUSCNT)="END OF FILE"_U_XUSEOL
Q
XUSNPIX4 ;OAK_BP/CMW/SLT - NPI EXTRACT REPORT ;7/7/08 17:39
+1 ;;8.0;KERNEL;**438,452,453,481,528,548**; Jul 10, 1995;Build 27
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; Direct access to ^IBE(350.9, fields .02, 1.05, 19;.02, 19;1.01, 19;1.02, 19;1.03, 19;,1.04, 19;1.05 authorized by
+5 ; Integration Agreement #4964.
+6 ;
+7 ; NPI Extract Report
+8 ;
+9 ; Input parameter: N/A
+10 ;
+11 ; Other relevant variables:
+12 ; XUSRTN="XUSNPIX1NV" (current routine name, used for ^XTMP and ^TMP
+13 ; XUSRTN="XUSNPIX2NV" storage subscript)
+14 ; Storage Global:
+15 ; ^XTMP("XUSNPIX1VA",0) = Piece 1^Piece 2^Piece 3^Piece 4^Piece 5^Piece 6
+16 ; ^XTMP("XUSNPIX2VA",0)
+17 ; where:
+18 ; Piece 1 => Purge Date - 1 year in future
+19 ; Piece 2 => Create Date - Today
+20 ; Piece 3 => Description
+21 ; Piece 4 => Last Date Compiled
+22 ; Piece 5 => $H last run start time
+23 ; Piece 6 => $H last run completion time
+24 ;
+25 ; Entry Point - ENT called from XUSNPIX1
+26 ;
+27 QUIT
+28 ;
+29 ; Individual records
TYPE1(DTTM3,SITE,XUSPROD,XUSHDR,XUSP2P) ;
+1 NEW IBA0,NVIEN,XUSNPI,MAXSIZE,XUSEOL,XUSCNT
+2 NEW XUSI,XUSNM,XUSNV,XLFNC,XUSIZE,XUSDT,XUSNEW
+3 NEW TOTREC1
+4 ;
+5 ; Set Maximum Message Size
+6 SET MAXSIZE=300000
+7 ;
+8 ; Set end of line character
+9 SET XUSEOL="~~"
+10 ;
+11 SET XUSCNT=1
SET (TOTREC1,MSGCNT,XUSIZE)=0
+12 SET XUSNPI=""
+13 FOR
SET XUSNPI=$ORDER(^TMP("XUSNPI",$JOB,1,XUSNPI))
IF 'XUSNPI
QUIT
Begin DoDot:1
+14 SET XUSDATA=XUSNPI
+15 SET NVIEN=$GET(^TMP("XUSNPI",$JOB,1,XUSNPI))
+16 ;
+17 FOR XUSI=1:1:33
SET XUSNV(XUSI)=""
+18 SET IBA0=$GET(^IBA(355.93,NVIEN,0))
+19 SET XUSNM=$PIECE(IBA0,U)
+20 ; Break Name into components
+21 IF XUSNM'=""
Begin DoDot:2
+22 SET XLFNC=XUSNM
DO FORMAT^XLFNAME7(.XLFNC,,,,0)
+23 SET XUSNV(2)=XLFNC("GIVEN")
SET XUSNV(3)=XLFNC("MIDDLE")
SET XUSNV(4)=XLFNC("FAMILY")
+24 IF XLFNC("SUFFIX")'=""
SET XUSNV(4)=XUSNV(4)_" "_XLFNC("SUFFIX")
+25 KILL XLFNC
End DoDot:2
+26 SET XUSDATA=XUSDATA_U_XUSNV(2)_U_XUSNV(3)_U_XUSNV(4)
+27 ;TYPE
SET XUSNV(5)=1
+28 ;
+29 ; DOB (place holder)
+30 SET XUSNV(6)=""
+31 SET XUSDATA=XUSDATA_U_XUSNV(5)_U_XUSNV(6)
+32 ;
+33 ; Pay to Provider Address (7-12)
+34 SET XUSDATA=XUSDATA_U_XUSP2P
+35 ;
+36 ; Servicing Provider Address
+37 SET XUSNV(13)=$PIECE(IBA0,U,5)
+38 SET XUSNV(14)=$PIECE(IBA0,U,10)
+39 SET XUSNV(15)=$PIECE(IBA0,U,6)
+40 SET XUSNV(16)=$PIECE(IBA0,U,7)
+41 IF XUSNV(16)
SET XUSNV(16)=$PIECE($GET(^DIC(5,XUSNV(16),0)),U,2)
+42 SET XUSNV(17)=$PIECE(IBA0,U,8)
+43 SET XUSDATA=XUSDATA_U_XUSNV(13)_U_XUSNV(14)_U_XUSNV(15)_U_XUSNV(16)_U_XUSNV(17)
+44 ;
+45 ; Office Phone number (place holder)
+46 SET XUSNV(18)=""
+47 ;
+48 ; Degree Description / Degree Code (place holder)
+49 SET XUSNV(19)=""
+50 SET XUSNV(20)=""
+51 ;
+52 ; Get Taxonomy and specialty codes
+53 NEW NVTX,NVSPC,NVTAX
+54 SET NVTX=0
+55 FOR
SET NVTX=$ORDER(^IBA(355.93,NVIEN,"TAXONOMY","B",NVTX))
IF 'NVTX
QUIT
Begin DoDot:2
+56 SET NVSPC=$PIECE($GET(^USC(8932.1,NVTX,0)),U,9)
+57 ;S NVTAX=$P($G(^USC(8932.1,NVTX,0)),U,7)
+58 IF NVSPC'=""
Begin DoDot:3
+59 IF XUSNV(21)=""
SET XUSNV(21)=NVSPC
QUIT
+60 SET XUSNV(21)=XUSNV(21)_";"_NVSPC
+61 QUIT
End DoDot:3
+62 QUIT
End DoDot:2
+63 ;use "B" cross ref to find primary vs non-primary code 0 (no)!1 (yes), and only "A"'s
+64 SET NVTX=0
+65 FOR
SET NVTX=$ORDER(^IBA(355.93,NVIEN,"TAXONOMY",NVTX))
IF NVTX'?1N.N
QUIT
Begin DoDot:2
+66 SET IBA=$GET(^IBA(355.93,NVIEN,"TAXONOMY",NVTX,0))
+67 IF $PIECE(IBA,U,3)="A"
Begin DoDot:3
+68 IF $PIECE(IBA,U,2)=1
SET XUSNV(22)=$PIECE($GET(^USC(8932.1,$PIECE(IBA,U,1),0)),U,7)
+69 IF $PIECE(IBA,U,2)=0
Begin DoDot:4
+70 IF XUSNV(23)=""
SET XUSNV(23)=$PIECE($GET(^USC(8932.1,$PIECE(IBA,U,1),0)),U,7)
QUIT
+71 ;
+72 ; *** Start XU*8.0*548 - RBN ***
+73 ;
+74 IF (XUSNV(23)'[$PIECE($GET(^USC(8932.1,$PIECE(IBA,U,1),0)),U,7))&($PIECE($GET(^USC(8932.1,$PIECE(IBA,U,1),0)),U,7)'=XUSNV(22))
Begin DoDot:5
+75 SET XUSNV(23)=XUSNV(23)_";"_$PIECE($GET(^USC(8932.1,$PIECE(IBA,U,1),0)),U,7)
+76 ;
+77 ; *** End XU*8.0*548 - RBN ***
+78 ;
End DoDot:5
+79 QUIT
End DoDot:4
+80 QUIT
End DoDot:3
+81 QUIT
End DoDot:2
+82 KILL IBA
+83 ;
+84 ; Fed tax ID
+85 SET XUSNV(24)=$PIECE($GET(IBA0),U,9)
+86 ;
+87 SET XUSDATA=XUSDATA_U_XUSNV(18)_U_XUSNV(19)_U_XUSNV(20)_U_XUSNV(21)_U_XUSNV(22)
+88 SET XUSDATA=XUSDATA_U_XUSNV(23)_U_XUSNV(24)
+89 ;
+90 ; Medicare Part A/B
+91 SET XUSNV(25)=670899
+92 SET XUSNV(26)="VA"_$EXTRACT(SITE+10000,2,5)
+93 ;
+94 ; State Lic and DEA (place holder)
+95 SET XUSNV(27)=""
+96 SET XUSNV(28)=""
+97 ;
+98 ; Status and Creation/Termination Date (place holder)
+99 SET XUSNV(29)=""
+100 SET XUSNV(30)=""
+101 ; VISN Station
+102 SET XUSNV(31)=SITE
+103 ;
+104 SET XUSDATA=XUSDATA_U_XUSNV(25)_U_XUSNV(26)_U_XUSNV(27)
+105 SET XUSDATA=XUSDATA_U_XUSNV(28)_U_XUSNV(29)_U_XUSNV(30)_U_XUSNV(31)
+106 ;
+107 ;BCBS info
+108 KILL XUSBXID
+109 DO NNVAID^XUSNPIXU(NVIEN,.XUSBXID)
+110 ;
+111 ;Update counter and save Entry
+112 NEW XUSB,XUSB1
+113 SET XUSCNT=XUSCNT+1
SET TOTREC1=TOTREC1+1
+114 SET ^TMP(XUSRTN,$JOB,XUSCNT)=XUSDATA_U_XUSEOL
+115 SET XUSIZE=XUSIZE+$LENGTH(^TMP(XUSRTN,$JOB,XUSCNT))
+116 IF $DATA(XUSBXID)
Begin DoDot:2
+117 SET XUSB=""
+118 FOR
SET XUSB=$ORDER(XUSBXID(XUSB))
IF XUSB=""
QUIT
Begin DoDot:3
+119 ;add p 528
SET XUSB1=$GET(XUSBXID(XUSB))
IF XUSB1'=""
SET XUSB1="^"_XUSB1
+120 SET XUSCNT=XUSCNT+1
SET TOTREC1=TOTREC1+1
+121 ;add _XUSB1 p 528
SET ^TMP(XUSRTN,$JOB,XUSCNT)=XUSDATA_U_$$TRIM^XLFSTR(XUSB)_XUSB1_U_XUSEOL
+122 SET XUSIZE=XUSIZE+$LENGTH(^TMP(XUSRTN,$JOB,XUSCNT))
End DoDot:3
End DoDot:2
+123 IF XUSIZE>MAXSIZE
Begin DoDot:2
+124 DO EOF1(XUSRTN)
+125 ;sending the extracted data via MailMan
DO EMAIL^XUSNPIX3(XUSRTN)
+126 KILL ^TMP(XUSRTN,$JOB)
+127 SET ^TMP("XUSNPIXS",$JOB,3,MSGCNT)="1 (Non-VA)^"_(XUSCNT-2)
+128 SET ^TMP(XUSRTN,$JOB,1)=XUSHDR
+129 SET XUSCNT=1
SET XUSIZE=0
End DoDot:2
+130 KILL XUSNV,XUSDATA,XUSBXID
End DoDot:1
+131 ;
+132 DO EOF1(XUSRTN)
+133 ;
+134 ; Send last message (if it has records)
+135 IF $GET(XUSCNT)>1
Begin DoDot:1
+136 ;sending the extracted data via MailMan
DO EMAIL^XUSNPIX3(XUSRTN)
+137 KILL ^TMP(XUSRTN,$JOB)
+138 SET ^TMP("XUSNPIXS",$JOB,3,MSGCNT)="1 (Non-VA)^"_($GET(XUSCNT)-2)
End DoDot:1
+139 ;
+140 ; Update Summary
+141 SET ^XTMP("XUSNPIXT","1NV")=MSGCNT_U_TOTREC1_U_DTTM3
+142 QUIT
+143 ;
EOF1(XUSRTN) ;
+1 IF $GET(XUSCNT)=1
QUIT
+2 SET MSGCNT=MSGCNT+1
+3 SET ^TMP(XUSRTN,$JOB,1)=XUSHDR_U_"Message Number: "_MSGCNT_U_"Line Count: "_XUSCNT_U_DTTM3_U_$GET(XUSPROD)_U_XUSEOL
+4 SET XUSCNT=XUSCNT+1
+5 SET ^TMP(XUSRTN,$JOB,XUSCNT)="END OF FILE"_U_XUSEOL
+6 QUIT
+7 ;
TYPE2(DTTM3,SITE,XUSPROD,XUSHDR,XUSP2P) ;Facility/Group
+1 NEW IBA0,NVIEN,XUSNPI,MAXSIZE,XUSEOL,XUSCNT
+2 NEW XUSNV,XUSI,XUSNM,XLFNC,MSGCNT,XUSIZE,XUSDT,XUSNEW,TOTREC2
+3 ;
+4 ; Set Maximum Message Size
+5 SET MAXSIZE=300000
+6 ;
+7 ; Set end of line character
+8 SET XUSEOL="~~"
+9 ;
+10 SET XUSNPI=""
+11 SET XUSCNT=1
SET (TOTREC2,MSGCNT,XUSIZE)=0
+12 FOR
SET XUSNPI=$ORDER(^TMP("XUSNPI",$JOB,2,XUSNPI))
IF 'XUSNPI
QUIT
Begin DoDot:1
+13 SET XUSDATA=XUSNPI
+14 SET NVIEN=$GET(^TMP("XUSNPI",$JOB,2,XUSNPI))
+15 ;
+16 FOR XUSI=1:1:24
SET XUSNV(XUSI)=""
+17 SET IBA0=$GET(^IBA(355.93,NVIEN,0))
+18 ;Get Organization name
+19 SET XUSNV(2)=$PIECE(IBA0,U)
+20 ;Type
+21 SET XUSNV(3)=2
+22 ;
+23 SET XUSDATA=XUSDATA_U_XUSNV(2)_U_XUSNV(3)
+24 ;
+25 ; Pay to Provider Address (4-9)
+26 SET XUSDATA=XUSDATA_U_XUSP2P
+27 ;
+28 ; Servicing Provider Address
+29 SET XUSNV(10)=$PIECE(IBA0,U,5)
+30 SET XUSNV(11)=$PIECE(IBA0,U,10)
+31 SET XUSNV(12)=$PIECE(IBA0,U,6)
+32 SET XUSNV(13)=$PIECE(IBA0,U,7)
+33 ;SLT 9/23/10
IF XUSNV(13)
SET XUSNV(13)=$PIECE($GET(^DIC(5,XUSNV(13),0)),U,2)
+34 SET XUSNV(14)=$PIECE(IBA0,U,8)
+35 SET XUSDATA=XUSDATA_U_XUSNV(10)_U_XUSNV(11)_U_XUSNV(12)_U_XUSNV(13)_U_XUSNV(14)
+36 ;
+37 ;Office Phone number (place holder)
+38 SET XUSNV(15)=""
+39 ;
+40 ; get Taxonomy and Specialty
+41 NEW NVTX,NVSPC,NVTAX
+42 SET NVTX=0
+43 FOR
SET NVTX=$ORDER(^IBA(355.93,NVIEN,"TAXONOMY","B",NVTX))
IF 'NVTX
QUIT
Begin DoDot:2
+44 SET NVSPC=$PIECE($GET(^USC(8932.1,NVTX,0)),U,9)
+45 SET NVTAX=$PIECE($GET(^USC(8932.1,NVTX,0)),U,7)
+46 IF NVSPC'=""
Begin DoDot:3
+47 IF XUSNV(16)=""
SET XUSNV(16)=NVSPC
QUIT
+48 SET XUSNV(16)=XUSNV(16)_";"_NVSPC
End DoDot:3
+49 IF NVTAX'=""
Begin DoDot:3
+50 IF XUSNV(17)=""
SET XUSNV(17)=NVTAX
QUIT
+51 ;
+52 ; *** Start XU*8.0*548 - RBN ***
+53 ;
+54 ;S XUSNV(17)=XUSNV(17)_";"_NVTAX
+55 IF (XUSNV(17)'[NVTAX)
SET XUSNV(17)=XUSNV(17)_";"_NVTAX
+56 ;
+57 ; *** End XU*8.0*548 - RBN ***
End DoDot:3
End DoDot:2
+58 ;
+59 ; Fed Tax ID
+60 SET XUSNV(18)=$PIECE($GET(IBA0),U,9)
+61 ;
+62 ;Medicare A/B
+63 SET XUSNV(19)=670899
+64 SET XUSNV(20)="VA"_$EXTRACT(SITE+10000,2,5)
+65 ;
+66 SET XUSDATA=XUSDATA_U_XUSNV(15)_U_XUSNV(16)_U_XUSNV(17)_U_XUSNV(18)_U_XUSNV(19)_U_XUSNV(20)
+67 ;
+68 ;State License Number
+69 ;S XUSNV(20)=$P($G(IBA0),U,12)
+70 ;
+71 ;DEA Number (place holder)
+72 SET XUSNV(21)=""
+73 ;
+74 ;NCPDP #
+75 SET XUSNV(22)=""
+76 ;
+77 ;VISN STATION ID
+78 SET XUSNV(23)=SITE
+79 ;
+80 SET XUSDATA=XUSDATA_U_XUSNV(21)_U_XUSNV(22)_U_XUSNV(23)
+81 ;
+82 ;BCBS info
+83 KILL XUSBXID
+84 DO NNVAID^XUSNPIXU(NVIEN,.XUSBXID)
+85 ;
+86 ;Update counter and save Entry
+87 NEW XUSB,XUSB1
+88 SET XUSCNT=XUSCNT+1
SET TOTREC2=TOTREC2+1
+89 SET ^TMP(XUSRTN,$JOB,XUSCNT)=XUSDATA_U_XUSEOL
+90 SET XUSIZE=XUSIZE+$LENGTH(^TMP(XUSRTN,$JOB,XUSCNT))
+91 IF $DATA(XUSBXID)
Begin DoDot:2
+92 SET XUSB=""
+93 FOR
SET XUSB=$ORDER(XUSBXID(XUSB))
IF XUSB=""
QUIT
Begin DoDot:3
+94 ;add p 528
SET XUSB1=$GET(XUSBXID(XUSB))
IF XUSB1'=""
SET XUSB1="^"_XUSB1
+95 SET XUSCNT=XUSCNT+1
SET TOTREC2=TOTREC2+1
+96 ;add _XUSB1 p 528
SET ^TMP(XUSRTN,$JOB,XUSCNT)=XUSDATA_U_$$TRIM^XLFSTR(XUSB)_XUSB1_U_XUSEOL
+97 SET XUSIZE=XUSIZE+$LENGTH(^TMP(XUSRTN,$JOB,XUSCNT))
End DoDot:3
End DoDot:2
+98 IF XUSIZE>MAXSIZE
Begin DoDot:2
+99 DO EOF2(XUSRTN)
+100 ;sending the extracted data via MailMan
DO EMAIL^XUSNPIX3(XUSRTN)
+101 KILL ^TMP(XUSRTN,$JOB)
+102 SET ^TMP("XUSNPIXS",$JOB,4,MSGCNT)="2 (Non-VA)^"_(XUSCNT-2)
+103 SET ^TMP(XUSRTN,$JOB,1)=XUSHDR
+104 SET XUSCNT=1
SET XUSIZE=0
End DoDot:2
+105 KILL XUSNV,XUSDATA,XUSB,XUSBXID
End DoDot:1
+106 ;
+107 DO EOF2(XUSRTN)
+108 ;
+109 ; Send last message (if it has records)
+110 IF $GET(XUSCNT)>1
Begin DoDot:1
+111 ;sending the extracted data via MailMan
DO EMAIL^XUSNPIX3(XUSRTN)
+112 KILL ^TMP(XUSRTN,$JOB)
+113 SET ^TMP("XUSNPIXS",$JOB,4,MSGCNT)="2 (Non-VA)^"_($GET(XUSCNT)-2)
End DoDot:1
+114 ;
+115 ; Update Summary
+116 SET ^XTMP("XUSNPIXT","2NV")=MSGCNT_U_TOTREC2_U_DTTM3
+117 QUIT
+118 ;
EOF2(XUSRTN) ;
+1 IF $GET(XUSCNT)=1
QUIT
+2 SET MSGCNT=MSGCNT+1
+3 SET ^TMP(XUSRTN,$JOB,1)=XUSHDR_U_"Message Number: "_MSGCNT_U_"Line Count: "_XUSCNT_U_DTTM3_U_$GET(XUSPROD)_U_XUSEOL
+4 SET XUSCNT=XUSCNT+1
+5 SET ^TMP(XUSRTN,$JOB,XUSCNT)="END OF FILE"_U_XUSEOL
+6 QUIT