VAFHLIN2 ;ALB/GRR/SCK - HL7 IN2 SEGMENT BUILDER ;06/08/99~4-MAR-05
;;5.3;Registration;**190,421,670,1015**;Aug 13, 1993;Build 21
;
;This routine will build an HL7 IN2 segment for an inpatient.
;
EN(DFN,VAFHMIEN,VAFSTR) ;Entry point of routine
;DFN - Patient Internal Entry Number
;VAFHMIEN - Patient Movement Internal Entry Number
;VAFSTR - Sequence numbers to be included
;
; Patch 670
; The Insurance Encapsulation API does not return the Insured's
; Employer Name and ID (IN2-3) at this time. This field will not
; be populated.
;
N VAFINS,VAFHLREC,VAFHA,VAFHSUB,VAFHADD,VAFHLOC,VAFHNAME,VAFX,VAFTMP S VAFHSUB=""
;S VAFX=$$INSUR^IBBAPI(DFN,,"R",.VAFTMP,"*") ;ihs/cmi/maw 02/08/2012 patch 1014 no IB
S $P(VAFHLREC,HL("FS"))="IN2" ;Set segment type to IN2
I VAFSTR[",2," S $P(VAFHLREC,HL("FS"),3)=$$GET1^DIQ(2,DFN,".09","I") ;Patient SSN
I VAFSTR[",3," S $P(VAFHLREC,HL("FS"),4)=$E(HL("ECH")) ; VAFHNAME=$P($G(VAFINS(2,2)),"^",9),$P(VAFHLREC,HL("FS"),4)=$E(HL("ECH"))_VAFHNAME
I VAFSTR[",6," S $P(VAFHLREC,HL("FS"),7)=$$MEDICARE^DGRUUTL(DFN) ;Set to Medicare Number or null
I VAFSTR[",8," S $P(VAFHLREC,HL("FS"),9)=$$MEDICAID^DGRUUTL(DFN) ;Set to Medicaid Number or null; p-421
QUITIN2 Q VAFHLREC
VAFHLIN2 ;ALB/GRR/SCK - HL7 IN2 SEGMENT BUILDER ;06/08/99~4-MAR-05
+1 ;;5.3;Registration;**190,421,670,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ;This routine will build an HL7 IN2 segment for an inpatient.
+4 ;
EN(DFN,VAFHMIEN,VAFSTR) ;Entry point of routine
+1 ;DFN - Patient Internal Entry Number
+2 ;VAFHMIEN - Patient Movement Internal Entry Number
+3 ;VAFSTR - Sequence numbers to be included
+4 ;
+5 ; Patch 670
+6 ; The Insurance Encapsulation API does not return the Insured's
+7 ; Employer Name and ID (IN2-3) at this time. This field will not
+8 ; be populated.
+9 ;
+10 NEW VAFINS,VAFHLREC,VAFHA,VAFHSUB,VAFHADD,VAFHLOC,VAFHNAME,VAFX,VAFTMP
SET VAFHSUB=""
+11 ;S VAFX=$$INSUR^IBBAPI(DFN,,"R",.VAFTMP,"*") ;ihs/cmi/maw 02/08/2012 patch 1014 no IB
+12 ;Set segment type to IN2
SET $PIECE(VAFHLREC,HL("FS"))="IN2"
+13 ;Patient SSN
IF VAFSTR[",2,"
SET $PIECE(VAFHLREC,HL("FS"),3)=$$GET1^DIQ(2,DFN,".09","I")
+14 ; VAFHNAME=$P($G(VAFINS(2,2)),"^",9),$P(VAFHLREC,HL("FS"),4)=$E(HL("ECH"))_VAFHNAME
IF VAFSTR[",3,"
SET $PIECE(VAFHLREC,HL("FS"),4)=$EXTRACT(HL("ECH"))
+15 ;Set to Medicare Number or null
IF VAFSTR[",6,"
SET $PIECE(VAFHLREC,HL("FS"),7)=$$MEDICARE^DGRUUTL(DFN)
+16 ;Set to Medicaid Number or null; p-421
IF VAFSTR[",8,"
SET $PIECE(VAFHLREC,HL("FS"),9)=$$MEDICAID^DGRUUTL(DFN)
QUITIN2 QUIT VAFHLREC