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

IBCNSJ.m

Go to the documentation of this file.
  1. IBCNSJ ;ALB/CPM - INSURANCE PLAN UTILITIES ; 30-DEC-94
  1. ;;Version 2.0 ; INTEGRATED BILLING ;**28,43**; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. DEL(IBPLAN) ; Delete an Insurance Plan
  1. ; Input: IBPLAN -- Pointer to the plan in file #355.3
  1. ;
  1. I '$G(IBPLAN) G DELQ
  1. N DA,DIDEL,DIK,IBX
  1. ;
  1. ; - delete all associated Benefits Used
  1. S IBX=0 F S IBX=$O(^IBA(355.5,"B",IBPLAN,IBX)) Q:'IBX D DBU(IBX)
  1. ;
  1. ; - delete all associated Annual Benefits
  1. S IBX=0 F S IBX=$O(^IBA(355.4,"C",IBPLAN,IBX)) Q:'IBX S DA=IBX,DIDEL=355.4,DIK="^IBA(355.4," D ^DIK
  1. ;
  1. ; - delete all associated coverage limitations
  1. S IBX=0 F S IBX=$O(^IBA(355.32,"B",IBPLAN,IBX)) Q:'IBX S DA=IBX,DIDEL=355.32,DIK="^IBA(355.32," D ^DIK
  1. ;
  1. ; - delete the plan itself
  1. S DA=IBPLAN,DIDEL=355.3,DIK="^IBA(355.3," D ^DIK
  1. DELQ Q
  1. ;
  1. DBU(DA) ; Delete Benefits Used.
  1. N DIDEL,DIK
  1. I $G(DA) S DIDEL=355.5,DIK="^IBA(355.5," D ^DIK
  1. Q
  1. ;
  1. IRACT(IBPLAN,IBF) ; Inactivate/reactivate an Insurance Plan
  1. ; Input: IBPLAN -- Pointer to the plan in file #355.3
  1. ; IBF -- 1 -> plan is to be inactivated
  1. ; 0 -> plan is to be reactivated
  1. ;
  1. I '$G(IBPLAN)!("^0^1^"'[("^"_$G(IBF)_"^")) G IRACTQ
  1. N DA,DIE,DR,X,Y
  1. S DA=IBPLAN,DR=".11////"_IBF,DIE="^IBA(355.3," D ^DIE
  1. D UPDATE^IBCNSP3(IBPLAN)
  1. IRACTQ Q
  1. ;
  1. COV(DFN) ; Update 'Covered by Insurance?' prompt
  1. ; Input: DFN -- Pointer to the patient in file #2
  1. ;
  1. ; This call differs from COVERED^IBCNSM31 in that field #.3192
  1. ; was not edited by the user, but an action on a plan or policy
  1. ; may require that this field be changed. Plus, there is no
  1. ; output to the screen.
  1. ;
  1. I '$G(DFN) G COVQ
  1. N X,Y,I,IBCOV,IBNCOV,DA,DR,DIE,DIC,IBINS,IBINSD
  1. S (IBCOV,IBNCOV)=$P($G(^DPT(DFN,.31)),"^",11)
  1. D ALL^IBCNS1(DFN,"IBINS",2,DT) S IBINSD=+$G(IBINS(0))
  1. S IBNCOV=$S('$O(^DPT(DFN,.312,0)):"N",IBINSD:"Y",1:"N")
  1. I IBCOV'=IBNCOV S DIE="^DPT(",DR=".3192////"_IBNCOV,DA=DFN D ^DIE
  1. COVQ Q
  1. ;
  1. COMP(GN) ; Compress Insurance Plan Name or Number
  1. ; Convert to caps and strip punctuation and leading zeroes.
  1. ; Input: GN -- Insurance plan name or number to be compressed
  1. ; Output: GN1 -- The compressed name or number
  1. ;
  1. N GN1,X
  1. S GN1=GN I GN1?."0" S GN1="" G COMPQ
  1. S GN1=$TR(GN1,"abcdefghijklmnopqrstuvwxyz!"" #$%&,()*+'-./:;<=>?@[]_\{|}","ABCDEFGHIJKLMNOPQRSTUVWXYZ") ; change lower-case to upper, strip away all punctuation
  1. F X=1:1:$L(GN1) Q:$E(GN1,X)'="0" ; strip off leading zeroes
  1. S GN1=$E(GN1,X,$L(GN1))
  1. I GN1?."0" S GN1=""
  1. COMPQ Q GN1
  1. ;
  1. ANYGP(X,EX,ALL) ; Does this insurance company offer any group plans?
  1. ; Input: X -- Pointer to the company in file #36
  1. ; EX -- Pointer to an insurance plan in file #355.3
  1. ; This optional input parameter is used to exclude
  1. ; a specific plan from being considered.
  1. ; ALL -- Set to 1 if inactive plans are to be included
  1. ; Output: 0 -- Company doesn't offer any group plans
  1. ; 1 -- Company does offer group plans
  1. ;
  1. N I,J,Y S Y=0
  1. I '$G(X) G ANYGPQ
  1. S I=0 F S I=$O(^IBA(355.3,"B",X,I)) Q:'I D Q:Y
  1. .I $G(EX),I=EX Q
  1. .S J=$G(^IBA(355.3,I,0))
  1. .I $P(J,"^",2) D
  1. ..I $G(ALL) S Y=1 Q
  1. ..I '$P(J,"^",11) S Y=1
  1. ANYGPQ Q Y
  1. ;
  1. SUBS(CO,PLAN,ANY,ARR,Z) ; How many possible plan subscriptions are there?
  1. ; Input: CO -- Pointer to the company in file #36
  1. ; PLAN -- Pointer to the plan in file #355.3
  1. ; ANY -- [Optional] Set to 1 if at least one subscriber
  1. ; is to be found
  1. ; ARR -- [Optional] If defined, all policies will be
  1. ; returned in this array as
  1. ;
  1. ; ARR(DFN,ien)="", where
  1. ;
  1. ; DFN points to the patient in file #2, and
  1. ; 'ien' points to the policy in file #2.312
  1. ;
  1. ; Z -- [Optional] Set to 1 if the call is just to
  1. ; determine that there is more than one subscriber
  1. ;
  1. ; Output: Number of (potential) plan subscriptions
  1. ;
  1. N DFN,STOP,X,Y S (STOP,X)=0
  1. I '$G(CO)!'$G(PLAN) G SUBSQ
  1. S DFN=0 F S DFN=$O(^DPT("AB",CO,DFN)) Q:'DFN D Q:STOP
  1. .S Y=0 F S Y=$O(^DPT("AB",CO,DFN,Y)) Q:'Y I $P($G(^DPT(DFN,.312,Y,0)),"^",18)=PLAN S X=X+1 S:$G(ARR)]"" @ARR@(DFN,Y)="" I $G(ANY) S STOP=1 Q
  1. .I 'STOP,X>1,$G(Z) S STOP=1
  1. SUBSQ Q X