DGIBDSP ;ALB/SCK - FORMATTED INSURANCE DISPLAY ; 16-JUNE-04
;;5.3;Registration;**570,670**;Aug 13, 1993
; This routine replaces the supported API DISP^IBCNS which provided a formatted
; display of patient insurance information. This functionality was removed
; when DBIA10146 was retired.
;
Q
;
DISP ;-Display all insurance company information
; -input DFN
; -input DGSTAT [optional] Defaults to "RAB" if not defined.
;
N DGDTIN
Q:'$D(DFN) D:'$D(IOF) HOME^%ZIS
;
N X,DGINS,DGX,DGRTN,DGERR,DGY
;
I '$D(DGSTAT) S DGSTAT="RAB"
S DGX=$$INSUR^IBBAPI(DFN,"",DGSTAT,.DGRTN,"*")
S:DGX<0 DGERR=$O(DGRTN("IBBAPI","INSUR","ERROR",0))
;
D HDR
I $G(DGERR) W !?6,DGRTN("IBBAPI","INSUR","ERROR",DGERR) G DISPQ
I 'DGX W !," No Insurance Information" G DISPQ
;
M DGINS=DGRTN("IBBAPI","INSUR")
S DGY=0
F S DGY=$O(DGINS(DGY)) Q:'DGY D D1(DGY)
;
DISPQ W ! I $D(DGRTN("BUFFER")) D
. I DGRTN("BUFFER")>0 W !?17,"*** Patient has Insurance Buffer entries ***"
K DGSTAT
Q
;
HDR ; -- print standard header
D HDR1("=",IOM-$S($G(DGDTIN):1,1:4))
Q
;
HDR1(CHAR,LENG) ; -- print header, specify character
N OFF
S OFF=$S($G(DGDTIN):0,1:2)
W !?(1+OFF),"Insurance",?(13+OFF),"COB",?(17+OFF),"Subscriber ID",?(35+OFF),"Group",?(47+OFF),"Holder",?(55+OFF),"Effect"_$S('OFF:"",1:"i")_"ve",?(65+OFF+$S('OFF:0,1:1)),"Expires" W:'OFF ?75,"Only"
I $G(CHAR)'="",LENG S X="",$P(X,CHAR,LENG)="" W !?(1+OFF),X
Q
;
D1(DGVAL) ;
N DGX,DGY,DGZ,CAT,OFF
;
Q:'$D(DGINS)
S OFF=$S($G(DGDTIN):0,1:2)
W !?(1+OFF),$S($D(DGINS(DGVAL,1)):$E($P(DGINS(DGVAL,1),U,2),1,10),1:"UNKNOWN")
S X=+DGINS(DGVAL,7) I X'="" S X=$S(X=1:"p",X=2:"s",X=3:"t",1:"")
W ?(14+OFF),X
W ?(17+OFF),$E(DGINS(DGVAL,14),1,16)
W ?(35+OFF),$E(DGINS(DGVAL,18),1,10)
S DGX=$P(DGINS(DGVAL,12),U,1)
W ?(47+OFF),$S(DGX="P":"SELF",DGX="S":"SPOUSE",1:"OTHER")
W ?(55+OFF),$TR($$FMTE^XLFDT(DGINS(DGVAL,10),"2DF")," ","0"),?(65+OFF+$S(OFF:1,1:0)),$TR($$FMTE^XLFDT(DGINS(DGVAL,11),"2DF")," ","0")
I 'OFF D
.I $P(DGINS(DGVAL,9),U,2)="NO" W ?75,"*WNR*" Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGIBDSP 2083 printed Dec 13, 2024@02:43:51 Page 2
DGIBDSP ;ALB/SCK - FORMATTED INSURANCE DISPLAY ; 16-JUNE-04
+1 ;;5.3;Registration;**570,670**;Aug 13, 1993
+2 ; This routine replaces the supported API DISP^IBCNS which provided a formatted
+3 ; display of patient insurance information. This functionality was removed
+4 ; when DBIA10146 was retired.
+5 ;
+6 QUIT
+7 ;
DISP ;-Display all insurance company information
+1 ; -input DFN
+2 ; -input DGSTAT [optional] Defaults to "RAB" if not defined.
+3 ;
+4 NEW DGDTIN
+5 if '$DATA(DFN)
QUIT
if '$DATA(IOF)
DO HOME^%ZIS
+6 ;
+7 NEW X,DGINS,DGX,DGRTN,DGERR,DGY
+8 ;
+9 IF '$DATA(DGSTAT)
SET DGSTAT="RAB"
+10 SET DGX=$$INSUR^IBBAPI(DFN,"",DGSTAT,.DGRTN,"*")
+11 if DGX<0
SET DGERR=$ORDER(DGRTN("IBBAPI","INSUR","ERROR",0))
+12 ;
+13 DO HDR
+14 IF $GET(DGERR)
WRITE !?6,DGRTN("IBBAPI","INSUR","ERROR",DGERR)
GOTO DISPQ
+15 IF 'DGX
WRITE !," No Insurance Information"
GOTO DISPQ
+16 ;
+17 MERGE DGINS=DGRTN("IBBAPI","INSUR")
+18 SET DGY=0
+19 FOR
SET DGY=$ORDER(DGINS(DGY))
if 'DGY
QUIT
DO D1(DGY)
+20 ;
DISPQ WRITE !
IF $DATA(DGRTN("BUFFER"))
Begin DoDot:1
+1 IF DGRTN("BUFFER")>0
WRITE !?17,"*** Patient has Insurance Buffer entries ***"
End DoDot:1
+2 KILL DGSTAT
+3 QUIT
+4 ;
HDR ; -- print standard header
+1 DO HDR1("=",IOM-$SELECT($GET(DGDTIN):1,1:4))
+2 QUIT
+3 ;
HDR1(CHAR,LENG) ; -- print header, specify character
+1 NEW OFF
+2 SET OFF=$SELECT($GET(DGDTIN):0,1:2)
+3 WRITE !?(1+OFF),"Insurance",?(13+OFF),"COB",?(17+OFF),"Subscriber ID",?(35+OFF),"Group",?(47+OFF),"Holder",?(55+OFF),"Effect"_$SELECT('OFF:"",1:"i")_"ve",?(65+OFF+$SELECT('OFF:0,1:1)),"Expires"
if 'OFF
WRITE ?75,"Only"
+4 IF $GET(CHAR)'=""
IF LENG
SET X=""
SET $PIECE(X,CHAR,LENG)=""
WRITE !?(1+OFF),X
+5 QUIT
+6 ;
D1(DGVAL) ;
+1 NEW DGX,DGY,DGZ,CAT,OFF
+2 ;
+3 if '$DATA(DGINS)
QUIT
+4 SET OFF=$SELECT($GET(DGDTIN):0,1:2)
+5 WRITE !?(1+OFF),$SELECT($DATA(DGINS(DGVAL,1)):$EXTRACT($PIECE(DGINS(DGVAL,1),U,2),1,10),1:"UNKNOWN")
+6 SET X=+DGINS(DGVAL,7)
IF X'=""
SET X=$SELECT(X=1:"p",X=2:"s",X=3:"t",1:"")
+7 WRITE ?(14+OFF),X
+8 WRITE ?(17+OFF),$EXTRACT(DGINS(DGVAL,14),1,16)
+9 WRITE ?(35+OFF),$EXTRACT(DGINS(DGVAL,18),1,10)
+10 SET DGX=$PIECE(DGINS(DGVAL,12),U,1)
+11 WRITE ?(47+OFF),$SELECT(DGX="P":"SELF",DGX="S":"SPOUSE",1:"OTHER")
+12 WRITE ?(55+OFF),$TRANSLATE($$FMTE^XLFDT(DGINS(DGVAL,10),"2DF")," ","0"),?(65+OFF+$SELECT(OFF:1,1:0)),$TRANSLATE($$FMTE^XLFDT(DGINS(DGVAL,11),"2DF")," ","0")
+13 IF 'OFF
Begin DoDot:1
+14 IF $PIECE(DGINS(DGVAL,9),U,2)="NO"
WRITE ?75,"*WNR*"
QUIT
End DoDot:1
+15 QUIT