IBCNEHLM ;DAOU/ALA - HL7 Registration MFN Message ; 02-JUN-2015
;;2.0;INTEGRATED BILLING;**184,251,300,416,438,497,506,549,601,621,631,659,664,687,702,732,752**;21-MAR-94;Build 20
;;Per VA Directive 6402, this routine should not be modified.
;
;**Program Description**
; This program will process the outgoing registration MFN message
;
; Variables
; MCT = Lines of MailMan message counter
; QFL = Quit flag
; HL* = HL7 package specific variables
; TAXID = Tax ID
; CNTCPH = Contact Phone
; CNTCEM = Contact Email
; FRSH = Freshness Days
; MGRP = Mailgroup to email messages to
; INACT = Inactive Insurance Flag
; APP = Application
; EVENT = HL7 Event
; CODE = Values sent in the MFN message
; IPP = IP Port
; IPA = IP Address
; RESP = Response Code
; IHLP = Interface HL7 Processing Type
; IHLT = Interface HL7 Batch Start Time
; IHLS = Interface HL7 Batch Stop Time
; IVER = Interface Version
; TIMOUT = Timeout Days Site Parameter
; RETRY = Retry Flag Site Parameter
;
N IBPERSIST
S IBPERSIST="N" ; persistence flag - If "N", FSC will not use the statistics on the NTE segment
D REG
Q
;
EN1 ; TaskMan entry point
N IBPERSIST
S IBPERSIST="Y" ; persistence flag - If "Y", FSC will use NTE segment to update their copy of the site's stats
D REG
; Purge the task record
S ZTREQ="@"
Q
;
REG ; Registration message for when a site installs
;
;/vd-IB*2.0*659 - Quit if VAMC Site is MANILA (#358) & EIV is disabled for MANILA.
I $P($$SITE^VASITE,U,3)=358,$$GET1^DIQ(350.9,"1,",51.33,"I")="N" Q
;
N APP,CNTCEM,CNTCNM,CNTCPH,CODE,EDT,EVENT,FRSH,HL,HLCDOM,HLCINS,HLCS
N HLCSTCP,HLECH,HLEID,HLFS,HLHDR,HLINST,HLIP,HLN,HLNHLQ,HLPROD,HLQ,HLREP
N HLRESLT,HLSAN,HLTYPE,HLX,IBCNE,IBCNEDAT,IHLP,IHLS,IHLT,ID,INACT,IPA,IPP
N MCT,MFE,MFN,MGRP,QFL,RESP,TAXID,ZMID,%I
N IVER,RETRY,TIMOUT,VMFE ; IB*2.0*506
K ^TMP("HLS",$J) S MCT=0,QFL=0
;
; Get data from IB Parameters File
S TAXID=$TR($P($G(^IBE(350.9,1,1)),U,5),"-",""),CNTCPH="",CNTCEM="",CNTCNM=""
S IBCNE=$G(^IBE(350.9,1,51))
S FRSH=$P(IBCNE,U,1),TIMOUT=$P(IBCNE,U,5),RETRY=$P(IBCNE,U,26) ; IB*2.0*506
S MGRP=$$MGRP^IBCNEUT5()
S INACT=$E($$GET1^DIQ(350.9,"1,",51.08,"E"))
S IHLP=$P(IBCNE,U,13),IHLT=$P(IBCNE,U,14)
S IHLS=$P(IBCNE,U,19)
;
; IB*2.0*184 version 1, initial release of IIV
; IB*2.0*549 Updated version to 7, Removed retrieval of Contact Name, Phone, email
; IB*2.0*601 Updated version to 8
; IB*2.0*621 Updated version to 9, EICD
; IB*2.0*631 Updated version to 10
; IB*2.0*659 Updated version to 11, Added Medicare Freshness Days to this registration msg
; IB*2.0*664 Now version 12, Stats going to FSC: auto update #s split (non-medicare vs medicare)
; IB*2.0*687 Now version 13, IIU Functionality Added.
; IB*2.0*702 Now version 14, Added EICD & MBI stats (pieces 27-30)
; IB*2.0*732 Now version 15, Added ISBLUE indicator (365.12,.09) and NUMBER RETRIES (#350.9,51.06) to Table Updates
; IB*2.0*752 Now version 16, To allow FSC to send IN1 & GT1 data (including SUBSCRIBER ID, etc.)
; for a 271 w/ a AAA error. Also added FSC control of file numbers #365.022 - #365.046
; (minus #365.030 & #365.040)
;
S IVER="16"
I IHLP="I" S (IHLT,IHLS)=""
;
I IHLP="B",IHLT=""!(IHLS="") D S QFL=1
. S MCT=MCT+1,MSG(MCT)="The ""HL7 Response Processing Method"" selected is Batch but the HL7 Batch "
. I IHLT="",IHLS="" S MSG(MCT)=MSG(MCT)_"Start and End Times are blank. " Q
. S MSG(MCT)=MSG(MCT)_$S(IHLT="":"Start",1:"End")_" Time is blank. "
;
I FRSH=""!(INACT="")!(IHLP="") D
. S MCT=MCT+1,MSG(MCT)="The following eIV Site Parameters are not defined: "
. I FRSH="" S MCT=MCT+1,MSG(MCT)="""Days between electronic re-verification checks"" is blank. "
. I INACT="" S MCT=MCT+1,MSG(MCT)="""Look at a patient's inactive insurance?"" is blank. "
. I IHLP="" S MCT=MCT+1,MSG(MCT)="""HL7 Response Processing Method"" is blank. "
. Q
;
I $O(MSG(""))'="" D MLMN
I QFL=1 Q
;
HL ; When a site installs, the enrollment should be an
; "MUP" (update) record.
N DSTAT,DSTAT2,VNTE,VZRR ; IB*2.0*549 added DSTAT2
S MFE(1)="MUP"
;
; Initialize the HL7
D INIT^HLFNC2("IBCNE IIV REGISTER",.HL)
S HLFS=HL("FS"),HLECH=HL("ECH"),HL("SAF")=$P($$SITE^VASITE,U,2,3),HLREP=$E(HL("ECH"),2)
; S HLEID=$$HLP^IBCNEHLU("IBCNE IIV REGISTER")
;
; Set the MFI segment
S ID="Facility Table",APP="",EVENT="UPD",RESP="NE"
S ^TMP("HLS",$J,1)=$$MFI^VAFHLMFI(ID,APP,EVENT,,,RESP)
;
; Set the MFE segment
S EVENT=MFE(1),MFN="",EDT=$$DT^XLFDT()
S CODE=$P($$SITE^VASITE,U,3)_$E(HLECH)
S VMFE=$$MFE^VAFHLMFE(EVENT,MFN,EDT,CODE)
S ^TMP("HLS",$J,2)=VMFE_HLFS_"CE"
;
; Set the ZRR segment
;IB*549 Added line to send null values for removed fields so msg layout remains unchanged
S (CNTCPH,CNTCEM,CNTCNM)=""
S VZRR="ZRR"_HLFS_"1"_HLFS_TAXID_HLFS_HLFS_$$HLNAME^HLFNC(CNTCNM,$E(HLECH))_"^C"_HLFS
S VZRR=VZRR_CNTCPH_$E(HLECH)_$E(HLECH)_$E(HLECH)_CNTCEM_HLFS_FRSH_HLFS_IHLP_HLFS_IHLT_$E(HLECH)_IHLS_HLFS_INACT_HLFS_IVER
S ^TMP("HLS",$J,3)=VZRR
;
; Set the NTE segment
;IB*2.0*664/DW- Added logic to separate the Medicare auto updates (MCAUTO)
; from non-Medicare auto updates
N MCAUTO
; IB*2.0*702/DTG- start Added number of outgoing EICD (A1) 270 transactions
; number of outgoing EICD-triggered (A2) 270 transactions
; number of outgoing MBI Request 270 transactions
; number of incoming MBI positive responses that indicated as having returned the MBI (%)
; DSTAT3 is set in IBCNEDST
N DSTATI,DSTAT3,DSTATPA
S DSTATI=1,DSTAT3="",DSTATPA=HLREP
; IB*2.0*702/DTG- end Added
S DSTAT=$$GETSTAT^IBCNEDST(.MCAUTO)
S DSTAT2=$$GETSTAT2^IBCNEDST() ; IB*2.0*549 Added line
S VNTE="NTE"_HLFS_"1"_HLFS_HLFS_IBPERSIST_HLREP_$TR(DSTAT,U,HLREP)
S VNTE=VNTE_HLREP_RETRY_HLREP_TIMOUT ; IB*2.0*506
S VNTE=VNTE_HLREP_$TR(DSTAT2,U,HLREP) ; IB*2.0*549 Added line
S VNTE=VNTE_HLREP_MCAUTO
; IB*2.0*702/DTG- Added start
I $G(DSTAT3)'="" S VNTE=VNTE_HLREP_DSTAT3
; IB*2.0*702/DTG Added end
S ^TMP("HLS",$J,4)=VNTE
;
D GENERATE^HLMA("IBCNE IIV REGISTER","GM",1,.HLRESLT,"")
I $P(HLRESLT,U,2)]"" S HLRESLT="Error - "_$P(HLRESLT,U,2,99) D Q
. S MSG(1)="HL7 eIV Registration Message not created."
. S MSG(2)=HLRESLT
. D MLMN
K ^TMP("HLS",$J)
Q
;
MLMN ; MailMan Message
D TXT^IBCNEUT7("MSG")
S XMSUB="eIV Registration Failure"
D MSG^IBCNEUT5(MGRP,XMSUB,"MSG(")
K XMSUB,XMY,MSG,XMZ,XMDUZ
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNEHLM 6760 printed Dec 13, 2024@02:14:44 Page 2
IBCNEHLM ;DAOU/ALA - HL7 Registration MFN Message ; 02-JUN-2015
+1 ;;2.0;INTEGRATED BILLING;**184,251,300,416,438,497,506,549,601,621,631,659,664,687,702,732,752**;21-MAR-94;Build 20
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ;**Program Description**
+5 ; This program will process the outgoing registration MFN message
+6 ;
+7 ; Variables
+8 ; MCT = Lines of MailMan message counter
+9 ; QFL = Quit flag
+10 ; HL* = HL7 package specific variables
+11 ; TAXID = Tax ID
+12 ; CNTCPH = Contact Phone
+13 ; CNTCEM = Contact Email
+14 ; FRSH = Freshness Days
+15 ; MGRP = Mailgroup to email messages to
+16 ; INACT = Inactive Insurance Flag
+17 ; APP = Application
+18 ; EVENT = HL7 Event
+19 ; CODE = Values sent in the MFN message
+20 ; IPP = IP Port
+21 ; IPA = IP Address
+22 ; RESP = Response Code
+23 ; IHLP = Interface HL7 Processing Type
+24 ; IHLT = Interface HL7 Batch Start Time
+25 ; IHLS = Interface HL7 Batch Stop Time
+26 ; IVER = Interface Version
+27 ; TIMOUT = Timeout Days Site Parameter
+28 ; RETRY = Retry Flag Site Parameter
+29 ;
+30 NEW IBPERSIST
+31 ; persistence flag - If "N", FSC will not use the statistics on the NTE segment
SET IBPERSIST="N"
+32 DO REG
+33 QUIT
+34 ;
EN1 ; TaskMan entry point
+1 NEW IBPERSIST
+2 ; persistence flag - If "Y", FSC will use NTE segment to update their copy of the site's stats
SET IBPERSIST="Y"
+3 DO REG
+4 ; Purge the task record
+5 SET ZTREQ="@"
+6 QUIT
+7 ;
REG ; Registration message for when a site installs
+1 ;
+2 ;/vd-IB*2.0*659 - Quit if VAMC Site is MANILA (#358) & EIV is disabled for MANILA.
+3 IF $PIECE($$SITE^VASITE,U,3)=358
IF $$GET1^DIQ(350.9,"1,",51.33,"I")="N"
QUIT
+4 ;
+5 NEW APP,CNTCEM,CNTCNM,CNTCPH,CODE,EDT,EVENT,FRSH,HL,HLCDOM,HLCINS,HLCS
+6 NEW HLCSTCP,HLECH,HLEID,HLFS,HLHDR,HLINST,HLIP,HLN,HLNHLQ,HLPROD,HLQ,HLREP
+7 NEW HLRESLT,HLSAN,HLTYPE,HLX,IBCNE,IBCNEDAT,IHLP,IHLS,IHLT,ID,INACT,IPA,IPP
+8 NEW MCT,MFE,MFN,MGRP,QFL,RESP,TAXID,ZMID,%I
+9 ; IB*2.0*506
NEW IVER,RETRY,TIMOUT,VMFE
+10 KILL ^TMP("HLS",$JOB)
SET MCT=0
SET QFL=0
+11 ;
+12 ; Get data from IB Parameters File
+13 SET TAXID=$TRANSLATE($PIECE($GET(^IBE(350.9,1,1)),U,5),"-","")
SET CNTCPH=""
SET CNTCEM=""
SET CNTCNM=""
+14 SET IBCNE=$GET(^IBE(350.9,1,51))
+15 ; IB*2.0*506
SET FRSH=$PIECE(IBCNE,U,1)
SET TIMOUT=$PIECE(IBCNE,U,5)
SET RETRY=$PIECE(IBCNE,U,26)
+16 SET MGRP=$$MGRP^IBCNEUT5()
+17 SET INACT=$EXTRACT($$GET1^DIQ(350.9,"1,",51.08,"E"))
+18 SET IHLP=$PIECE(IBCNE,U,13)
SET IHLT=$PIECE(IBCNE,U,14)
+19 SET IHLS=$PIECE(IBCNE,U,19)
+20 ;
+21 ; IB*2.0*184 version 1, initial release of IIV
+22 ; IB*2.0*549 Updated version to 7, Removed retrieval of Contact Name, Phone, email
+23 ; IB*2.0*601 Updated version to 8
+24 ; IB*2.0*621 Updated version to 9, EICD
+25 ; IB*2.0*631 Updated version to 10
+26 ; IB*2.0*659 Updated version to 11, Added Medicare Freshness Days to this registration msg
+27 ; IB*2.0*664 Now version 12, Stats going to FSC: auto update #s split (non-medicare vs medicare)
+28 ; IB*2.0*687 Now version 13, IIU Functionality Added.
+29 ; IB*2.0*702 Now version 14, Added EICD & MBI stats (pieces 27-30)
+30 ; IB*2.0*732 Now version 15, Added ISBLUE indicator (365.12,.09) and NUMBER RETRIES (#350.9,51.06) to Table Updates
+31 ; IB*2.0*752 Now version 16, To allow FSC to send IN1 & GT1 data (including SUBSCRIBER ID, etc.)
+32 ; for a 271 w/ a AAA error. Also added FSC control of file numbers #365.022 - #365.046
+33 ; (minus #365.030 & #365.040)
+34 ;
+35 SET IVER="16"
+36 IF IHLP="I"
SET (IHLT,IHLS)=""
+37 ;
+38 IF IHLP="B"
IF IHLT=""!(IHLS="")
Begin DoDot:1
+39 SET MCT=MCT+1
SET MSG(MCT)="The ""HL7 Response Processing Method"" selected is Batch but the HL7 Batch "
+40 IF IHLT=""
IF IHLS=""
SET MSG(MCT)=MSG(MCT)_"Start and End Times are blank. "
QUIT
+41 SET MSG(MCT)=MSG(MCT)_$SELECT(IHLT="":"Start",1:"End")_" Time is blank. "
End DoDot:1
SET QFL=1
+42 ;
+43 IF FRSH=""!(INACT="")!(IHLP="")
Begin DoDot:1
+44 SET MCT=MCT+1
SET MSG(MCT)="The following eIV Site Parameters are not defined: "
+45 IF FRSH=""
SET MCT=MCT+1
SET MSG(MCT)="""Days between electronic re-verification checks"" is blank. "
+46 IF INACT=""
SET MCT=MCT+1
SET MSG(MCT)="""Look at a patient's inactive insurance?"" is blank. "
+47 IF IHLP=""
SET MCT=MCT+1
SET MSG(MCT)="""HL7 Response Processing Method"" is blank. "
+48 QUIT
End DoDot:1
+49 ;
+50 IF $ORDER(MSG(""))'=""
DO MLMN
+51 IF QFL=1
QUIT
+52 ;
HL ; When a site installs, the enrollment should be an
+1 ; "MUP" (update) record.
+2 ; IB*2.0*549 added DSTAT2
NEW DSTAT,DSTAT2,VNTE,VZRR
+3 SET MFE(1)="MUP"
+4 ;
+5 ; Initialize the HL7
+6 DO INIT^HLFNC2("IBCNE IIV REGISTER",.HL)
+7 SET HLFS=HL("FS")
SET HLECH=HL("ECH")
SET HL("SAF")=$PIECE($$SITE^VASITE,U,2,3)
SET HLREP=$EXTRACT(HL("ECH"),2)
+8 ; S HLEID=$$HLP^IBCNEHLU("IBCNE IIV REGISTER")
+9 ;
+10 ; Set the MFI segment
+11 SET ID="Facility Table"
SET APP=""
SET EVENT="UPD"
SET RESP="NE"
+12 SET ^TMP("HLS",$JOB,1)=$$MFI^VAFHLMFI(ID,APP,EVENT,,,RESP)
+13 ;
+14 ; Set the MFE segment
+15 SET EVENT=MFE(1)
SET MFN=""
SET EDT=$$DT^XLFDT()
+16 SET CODE=$PIECE($$SITE^VASITE,U,3)_$EXTRACT(HLECH)
+17 SET VMFE=$$MFE^VAFHLMFE(EVENT,MFN,EDT,CODE)
+18 SET ^TMP("HLS",$JOB,2)=VMFE_HLFS_"CE"
+19 ;
+20 ; Set the ZRR segment
+21 ;IB*549 Added line to send null values for removed fields so msg layout remains unchanged
+22 SET (CNTCPH,CNTCEM,CNTCNM)=""
+23 SET VZRR="ZRR"_HLFS_"1"_HLFS_TAXID_HLFS_HLFS_$$HLNAME^HLFNC(CNTCNM,$EXTRACT(HLECH))_"^C"_HLFS
+24 SET VZRR=VZRR_CNTCPH_$EXTRACT(HLECH)_$EXTRACT(HLECH)_$EXTRACT(HLECH)_CNTCEM_HLFS_FRSH_HLFS_IHLP_HLFS_IHLT_$EXTRACT(HLECH)_IHLS_HLFS_INACT_HLFS_IVER
+25 SET ^TMP("HLS",$JOB,3)=VZRR
+26 ;
+27 ; Set the NTE segment
+28 ;IB*2.0*664/DW- Added logic to separate the Medicare auto updates (MCAUTO)
+29 ; from non-Medicare auto updates
+30 NEW MCAUTO
+31 ; IB*2.0*702/DTG- start Added number of outgoing EICD (A1) 270 transactions
+32 ; number of outgoing EICD-triggered (A2) 270 transactions
+33 ; number of outgoing MBI Request 270 transactions
+34 ; number of incoming MBI positive responses that indicated as having returned the MBI (%)
+35 ; DSTAT3 is set in IBCNEDST
+36 NEW DSTATI,DSTAT3,DSTATPA
+37 SET DSTATI=1
SET DSTAT3=""
SET DSTATPA=HLREP
+38 ; IB*2.0*702/DTG- end Added
+39 SET DSTAT=$$GETSTAT^IBCNEDST(.MCAUTO)
+40 ; IB*2.0*549 Added line
SET DSTAT2=$$GETSTAT2^IBCNEDST()
+41 SET VNTE="NTE"_HLFS_"1"_HLFS_HLFS_IBPERSIST_HLREP_$TRANSLATE(DSTAT,U,HLREP)
+42 ; IB*2.0*506
SET VNTE=VNTE_HLREP_RETRY_HLREP_TIMOUT
+43 ; IB*2.0*549 Added line
SET VNTE=VNTE_HLREP_$TRANSLATE(DSTAT2,U,HLREP)
+44 SET VNTE=VNTE_HLREP_MCAUTO
+45 ; IB*2.0*702/DTG- Added start
+46 IF $GET(DSTAT3)'=""
SET VNTE=VNTE_HLREP_DSTAT3
+47 ; IB*2.0*702/DTG Added end
+48 SET ^TMP("HLS",$JOB,4)=VNTE
+49 ;
+50 DO GENERATE^HLMA("IBCNE IIV REGISTER","GM",1,.HLRESLT,"")
+51 IF $PIECE(HLRESLT,U,2)]""
SET HLRESLT="Error - "_$PIECE(HLRESLT,U,2,99)
Begin DoDot:1
+52 SET MSG(1)="HL7 eIV Registration Message not created."
+53 SET MSG(2)=HLRESLT
+54 DO MLMN
End DoDot:1
QUIT
+55 KILL ^TMP("HLS",$JOB)
+56 QUIT
+57 ;
MLMN ; MailMan Message
+1 DO TXT^IBCNEUT7("MSG")
+2 SET XMSUB="eIV Registration Failure"
+3 DO MSG^IBCNEUT5(MGRP,XMSUB,"MSG(")
+4 KILL XMSUB,XMY,MSG,XMZ,XMDUZ
+5 QUIT