VAFHLIN2 ;ALB/GRR/SCK - HL7 IN2 SEGMENT BUILDER ;06/08/99~4-MAR-05
;;5.3;Registration;**190,421,670**;Aug 13, 1993
;
;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,"*")
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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFHLIN2 1190 printed Dec 13, 2024@03:02:59 Page 2
VAFHLIN2 ;ALB/GRR/SCK - HL7 IN2 SEGMENT BUILDER ;06/08/99~4-MAR-05
+1 ;;5.3;Registration;**190,421,670**;Aug 13, 1993
+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 SET VAFX=$$INSUR^IBBAPI(DFN,,"R",.VAFTMP,"*")
+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