Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBCNS

IBCNS.m

Go to the documentation of this file.
  1. IBCNS ;ALB/AAS - IS INSURANCE ACTIVE ; 22-JULY-91
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ;MAP TO DGCRNS
  1. ;
  1. ;Input - DFN = patient
  1. ; - IBINDT = (optional) date to check ins active for or today if not defined
  1. ; - IBOUTP = (optional) 1 if want active insurance returned in IBDD(insurance company)=node in patient file
  1. ; - = 2 if want all ins returned
  1. ;
  1. ;Output - IBINS = 1 if has active ins., 0 if no active ins.
  1. ; - IBDD() = internal node in patient file of valid ins.
  1. ; - IBDDI() = internal node in patient file of invalid ins.
  1. ;
  1. % N J,X S IBINS=0 K IBDD,IBDDI
  1. S J=0 F S J=$O(^DPT(DFN,.312,J)) Q:'J I $D(^DPT(DFN,.312,J,0)) S X=^(0) D CHK
  1. Q
  1. ;
  1. CHK ;
  1. ;Input - IBI = entry in insurance multiple
  1. ;
  1. S Z=$S($D(IBINDT):IBINDT,1:DT),Z1=$S($D(IBOUTP):IBOUTP,1:0)
  1. G:'$D(^DIC(36,+X,0)) CHKQ S X1=^(0) ;insurance company entry doesn't exist
  1. I $P(X,"^",8) G:Z<$P(X,"^",8) CHKQ ;effective date later than care
  1. I $P(X,"^",4) G:Z>$P(X,"^",4) CHKQ ;care after expiration date
  1. G:$P(X1,"^",5) CHKQ ;insurance company inactive
  1. G:$P(X1,"^",2)="N" CHKQ ;insurance company will not reimburse
  1. S IBINS=1 I Z1 D
  1. .S IBDD(+X)=X
  1. .Q:'$P(IBDD(+X),"^",18)
  1. .S Y=$G(^IBA(355.3,+$P(IBDD(+X),"^",18),0))
  1. .I $P(Y,"^",4)'="" S $P(IBDD(+X),"^",3)=$P(Y,"^",4) ; move group number
  1. .I $P(Y,"^",3)'="" S $P(IBDD(+X),"^",15)=$P(Y,"^",3) ; move group name
  1. CHKQ I Z1=2&('$D(IBDD(+X))) D
  1. .S IBDDI(+X)=X
  1. .Q:'$P(IBDDI(+X),"^",18)
  1. .S Y=$G(^IBA(355.3,+$P(IBDDI(+X),"^",18),0))
  1. .I $P(Y,"^",4)'="" S $P(IBDDI(+X),"^",3)=$P(Y,"^",4) ; move group number
  1. .I $P(Y,"^",3)'="" S $P(IBDDI(+X),"^",15)=$P(Y,"^",3) ; move group name
  1. K X,X1,Z,Z1,Y Q
  1. ;
  1. DD ; - called from input transform and x-refs for field 101,102,103
  1. ; - input requires da=internal entry number in 399
  1. ; - outputs IBdd(ins co.) array
  1. N DFN S DFN=$P(^DGCR(399,DA,0),"^",2),IBOUTP=1,IBINDT=$S(+$G(^DGCR(399,DA,"U")):+$G(^("U")),1:DT)
  1. D %
  1. DDQ K IBOUTP,IBINDT Q
  1. ;
  1. ;
  1. DISP ; -Display all insurance company information
  1. ; -input DFN
  1. ;
  1. Q:'$D(DFN) D:'$D(IOF) HOME^%ZIS
  1. N X,IBINS,IBX
  1. D ALL^IBCNS1(DFN,"IBINS")
  1. ;
  1. D HDR
  1. I '$D(IBINS) W !," No Insurance Information" G DISPQ
  1. ;
  1. S X=0 F S X=$O(IBINS(X)) Q:'X S IBINS=IBINS(X,0) D D1 ; display
  1. ;
  1. DISPQ Q
  1. ;
  1. OLDISP ; -Display all insurance company information
  1. ; -input DFN
  1. ;
  1. Q:'$D(DFN) D:'$D(IOF) HOME^%ZIS
  1. ;
  1. S IBOUTP=2 D IBCNS
  1. ;
  1. D HDR
  1. I '$D(IBDD),'$D(IBDDI) W !," No Insurance Information" G DISPQ
  1. ;
  1. S X="" F S X=$O(IBDD(X)) Q:X="" S IBINS=IBDD(X) D D1 ;active insurance
  1. S X="" F S X=$O(IBDDI(X)) Q:X="" S IBINS=IBDDI(X) D D1 ;inactive ins
  1. ;
  1. OLDISPQ K IBDD,IBDDI,IBX
  1. Q
  1. ;
  1. HDR ; -- print standard header
  1. D HDR1("=",IOM-4)
  1. Q
  1. ;
  1. HDR1(CHAR,LENG) ; -- print header, specify character
  1. W !?4,"Insurance Co.",?22,"Subscriber ID",?40,"Group",?52,"Holder",?60,"Effective",?70,"Expires" I $G(CHAR)'="",LENG S X="",$P(X,CHAR,LENG)="" W !?4,X
  1. Q
  1. ;
  1. ;
  1. D1 N X Q:'$D(IBINS)
  1. W !?4,$S($D(^DIC(36,+IBINS,0)):$E($P(^(0),"^",1),1,16),1:"UNKNOWN")
  1. W ?22,$E($P(IBINS,"^",2),1,16)
  1. ;W ?40,$E($S($P(IBINS,"^",15)'="":$P(IBINS,"^",15),1:$P(IBINS,"^",3)),1,10)
  1. W ?40,$E($$GRP($P(IBINS,"^",18)),1,10)
  1. S X=$P(IBINS,"^",6) W ?52,$S(X="v":"SELF",X="s":"SPOUSE",1:"OTHER")
  1. W ?60,$$DAT1^IBOUTL($P(IBINS,"^",8)),?70,$$DAT1^IBOUTL($P(IBINS,"^",4))
  1. Q
  1. ;
  1. GRP(IBCPOL) ; -- return group name/group policy
  1. ; input: IBCPOL = pointer to entry in 355.3
  1. ; output: group name or group number, if both group NUMBER
  1. ; if neither 'Individual PLAN'
  1. ;
  1. N X,Y S X=""
  1. S X=$G(^IBA(355.3,+$G(IBCPOL),0))
  1. S Y=$S($P(X,"^",4)'="":$P(X,"^",4),1:$P(X,"^",3))
  1. I $P(X,"^",10) S Y="Ind. Plan "_Y
  1. GRPQ Q Y