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

IBCNBEE.m

Go to the documentation of this file.
  1. IBCNBEE ;ALB/ARH - Ins Buffer: add/edit existing entries in buffer ;1 Jun 97
  1. ;;2.0;INTEGRATED BILLING;**82,184,252,251,356,361,371,377,416,438,452,497,528**;21-MAR-94;Build 163
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ADD(IBSOURCE) ; add a new buffer file entry (#355.33), sets only status (0) node data
  1. N IBARR,IBERR,IBIFN,IBX I '$G(IBSOURCE) S IBSOURCE=1
  1. ;
  1. S IBARR(355.33,"+1,",.01)="NOW",IBARR(355.33,"+1,",.03)=IBSOURCE
  1. D UPDATE^DIE("E","IBARR","IBIFN","IBERR")
  1. S IBX=+$G(IBIFN(1)) I $D(IBERR) S $P(IBX,U,2)=$G(IBERR("DIERR",1,"TEXT",1))
  1. Q IBX
  1. ;
  1. STATUS(IBBUFDA,STATUS,NC,NG,NP) ; edit the status node
  1. ;
  1. N IBX,IBARR,IBIFN Q:'$G(IBBUFDA) S IBIFN=IBBUFDA_","
  1. D CHK^DIE(355.33,.04,"",$G(STATUS),.IBX) Q:IBX="^"
  1. ;
  1. S IBARR(355.33,IBIFN,.04)=STATUS I STATUS="R" S (NC,NG,NP)=0
  1. S IBARR(355.33,IBIFN,.07)=+$G(NC),IBARR(355.33,IBIFN,.08)=+$G(NG),IBARR(355.33,IBIFN,.09)=+$G(NP)
  1. D FILE^DIE("E","IBARR")
  1. Q
  1. ;
  1. INS(IBBUFDA,FLDS) ; edit the insurance company portion of a buffer file entry
  1. ;
  1. N DIC,DIE,DA,DR,X,Y,IBCNEXT1
  1. I $P($G(^IBA(355.33,+$G(IBBUFDA),0)),U,4)'="E" Q
  1. I $G(FLDS)="" S FLDS="MR"
  1. ;
  1. ; ESG - 6/18/02 - SDD 5.1.4 - Usage of Auto Match when editing
  1. ; - the insurance company name in the buffer. Also added an
  1. ; - input transform (see below) to clean up the data coming in.
  1. ; - fetch the current buffer ins co name
  1. ;
  1. I FLDS="MR" S IBCNEXT1=$P($G(^IBA(355.33,IBBUFDA,20)),U,1)
  1. ;
  1. S DR=$P($T(@(FLDS_"INS")+1),";;",2,9999) Q:DR=""
  1. ;
  1. I FLDS="MR" Q:$$INSNAME(IBBUFDA)<0 S DR=$P($T(@(FLDS_"INS")+1),";;",2,9999),DR=$P(DR,";",2,99999)
  1. ;
  1. S DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. GRP(IBBUFDA,FLDS) ; edit the group/plan portion of the buffer file entry
  1. ;
  1. N DIC,DIE,DA,DR,X,Y I $P($G(^IBA(355.33,+$G(IBBUFDA),0)),U,4)'="E" Q
  1. I $G(FLDS)="" S FLDS="MR"
  1. ;
  1. S DR=$P($T(@(FLDS_"GRP")+1),";;",2,9999) Q:DR=""
  1. S DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. POLICY(IBBUFDA,FLDS) ; edit the patient policy portion of the buffer file entry
  1. ;
  1. N DIC,DIE,DA,DR,X,Y,IBZZ I $P($G(^IBA(355.33,+$G(IBBUFDA),0)),U,4)'="E" Q
  1. I $G(FLDS)="" S FLDS="MR"
  1. ;
  1. S DR=$P($T(@(FLDS_"POL")+1),";;",2,9999)_$P($T(@(FLDS_"POL")+2),";;",2,9999) Q:DR=""
  1. S DIE="^IBA(355.33,",DA=IBBUFDA
  1. S DIE("NO^")="BACKOUTOK" D ^DIE K DIE,DA,DR Q:$D(Y)
  1. ;
  1. I FLDS="MR" D ESGHP(IBBUFDA)
  1. Q
  1. ;
  1. ESGHP(IBBUFDA) ; sponsoring employer information
  1. N DIR,DIRUT,DUOUT,DTOUT,VAOA,VAERR,VA,DFN,IB60,IBE,IBEMPST,IBREL
  1. ;
  1. ; if insured is patient or spouse, ask if insured's current employer is the plan's sponsoring employer, if yes auto stuff it
  1. I +$G(^IBA(355.33,IBBUFDA,61)) W ! S IB60=$G(^IBA(355.33,IBBUFDA,60)) D Q:$D(DIRUT)
  1. . ; sponsoring employer is current employer?
  1. . S DFN=+IB60,IBREL=$P(IB60,U,6),VAOA("A")=$S(IBREL="01":5,IBREL="02":6,1:"") I 'DFN!(VAOA("A")="") Q
  1. . D OAD^VADPT I $G(VAOA(9))="" Q
  1. . S DIR("?")="Enter Yes if this plan is sponsored by the "_$S(IBREL="01":"patient's",1:"spouse's")_" current employer."
  1. . S DIR("?",1)="Entering Yes will result in the "_$S(IBREL="01":"patient's",1:"spouse's")_" current employer data being",DIR("?",2)="added to the policy as the Sponsoring Employer data.",DIR("?",3)=""
  1. . S DIR("A")="Current Employer "_VAOA(9)_" Sponsors this Plan",DIR("B")="No",DIR(0)="Y" D ^DIR W ! I Y'=1 Q
  1. . ;
  1. . D DELEMP(IBBUFDA) ; delete any data already contained in these fields
  1. . ;
  1. . ; if the insured's current employer sponsors the plan then stuff that employer's address into the buffer
  1. . S IBE=$S(IBREL="01":.311,1:.25),IBEMPST=$P($G(^DPT(DFN,IBE)),U,15)
  1. . S DR="61.02///"_VAOA(9)_";61.03///"_IBEMPST_";61.06///"_$E(VAOA(1),1,30)_";61.07///"_$E(VAOA(2),1,30)
  1. . S DR=DR_";61.08///"_$E(VAOA(3),1,30)_";61.09///"_$E(VAOA(4),1,20)_";61.1////"_$P(VAOA(5),U,1)
  1. . S DR=DR_";61.11////"_$P(VAOA(11),U,1)_";61.12///"_$E(VAOA(8),1,15)
  1. . S DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR
  1. ;
  1. ; if employer sponsored plan, edit buffer entry's sponsoring employer info
  1. I +$G(^IBA(355.33,IBBUFDA,61)) S DR="61.02:61.12",DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR
  1. ;
  1. ; if not employer sponsored plan, delete any existing sponsoring employer data
  1. I $D(^IBA(355.33,IBBUFDA,61)),'$G(^IBA(355.33,IBBUFDA,61)) D DELEMP(IBBUFDA)
  1. Q
  1. ;
  1. ASKSAVE(NAME) ;asks the user if changes to the Patient Registration File (Subscriber data) should be saved
  1. ;returns 1 for yes, 0 for no
  1. K DIR S DIR(0)="Y",DIR("A")="Save changes to the "_NAME_" File",DIR("B")="YES"
  1. D ^DIR K DIR
  1. Q $S($D(DIRUT):0,1:Y)
  1. ;
  1. DELEMP(IBBUFDA) ; delete sponsoring employer data
  1. N DIC,DIE,DA,DR,X,Y Q:'$D(^IBA(355.33,+$G(IBBUFDA),61))
  1. S DR="61.02///@;61.03///@;61.04///@;61.05///@;61.06///@;61.07///@;61.08///@;61.09///@;61.10///@;61.11///@;61.12///@"
  1. S DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. INSHELP ;
  1. W !!,"------------------------ INSURANCE COMPANY INFORMATION -------------------------",!
  1. Q
  1. GRPHELP ;
  1. W !!,"---------------------------- GROUP/PLAN INFORMATION ----------------------------"
  1. W !," The following data defines a specific Group or Plan provided by an Insurance "
  1. W !," Company. This may be either a group plan with many potential members or an "
  1. W !," individual plan with a single member.",!
  1. Q
  1. POLHELP ;
  1. W !!,"---------------------- POLICY AND SUBSCRIBER INFORMATION -----------------------"
  1. W !," The following data defines the subscriber specific policy information for a "
  1. W !," particular Insurance Plan. The subscriber, the insured, and the policy holder "
  1. W !," all refer to the person who is a member of the plan and therefore holds the "
  1. W !," policy. The patient must be covered under the plan but may not be the policy"
  1. W !," holder.",!
  1. Q
  1. ;
  1. INSNAME(IBBUFDA) ; Reset insurance company name
  1. N DR,DIE,DA,Y,X,IBX,IBNEW,IBNAME
  1. S IBX=-1
  1. S DR=20.01,DIE="^IBA(355.33,",DA=IBBUFDA
  1. D ^DIE
  1. I '$D(Y) S IBNEW=$$CHECK(IBBUFDA)
  1. I +$G(IBNEW)'<0,$G(IBNEW)'=0,$D(IBNEW) S DR=$P(DR,";",1)_"////"_IBNEW S DIE="^IBA(355.33,",DA=IBBUFDA D ^DIE K DIE,DA,DR I '$D(Y) S IBX=0
  1. ; BHS - 10/15/03 - If user entered a caret during $$CHECK still set
  1. ; return value to 0 so the user can edit the other
  1. ; INS fields
  1. I $G(IBNEW)=0!($G(IBNEW)=-1) S IBX=0
  1. Q IBX
  1. ;
  1. CHECK(IBBUFDA) ; Select Insurance Company Name and Automatch
  1. ; Buffer file (#355.33), field# 20.01.
  1. ; ESG - 6/18/02 - SDD 5.1.4 - Usage of Auto Match when editing the
  1. ; insurance company name. Also, display the insurance company
  1. ; name lookup/lister and the Auto Match lookup/lister.
  1. ;
  1. NEW IBNEW,IBNAME,AMLIST
  1. ;
  1. S IBNEW=0,IBNAME=$P($G(^IBA(355.33,$G(IBBUFDA),20)),U,1)
  1. I IBNAME="" G CHECKQ
  1. ;
  1. ; Perform an insurance company lookup/lister
  1. ; BHS - 10/15/03 - Removed quits when user enters a caret to quit the
  1. ; the ins lister or Auto Match lister
  1. S IBNEW=$$DICINS^IBCNBU1(IBNAME,1,10)
  1. I IBNEW=0!(IBNEW<0) D
  1. . I '$$AMLOOK^IBCNEUT1(IBNAME,1,.AMLIST) Q
  1. . S IBNEW=$$AMSEL^IBCNEUT1(.AMLIST)
  1. ;
  1. ; user chose a valid insurance company - possible Auto Match add
  1. I IBNEW'<0,IBNEW'=0 D AMADD^IBCNEUT6(X,IBCNEXT1)
  1. ;
  1. CHECKQ Q IBNEW
  1. ;
  1. MRINS ; Insurance Company fields asked of MCCR users in the Buffer Process options (all buffer ins fields 20.01-21.06)
  1. ;;20.01;20.05;20.02:20.04;21.01;I X="" S Y="@111";21.02;I X="" S Y="@111";21.03;@111;21.04:21.06
  1. ;
  1. MRGRP ; Group/Plan fields asked of MCCR users in the Buffer Process options (all buffer grp fields 40.01,90.01,90.02,40.04-40.09)
  1. ;;40.01;90.01;90.02;40.1;40.11;40.09;40.04:40.08
  1. ;
  1. MRPOL ; Patient Policy fields asked of MCCR users in the Buffer Process options (all buffer policy fields except ESGHP,60.05,60.06 60.02-61.01
  1. ;;60.02;60.03;60.14PATIENT RELATIONSHIP TO SUBSCRIBER;S IBZZ=X;I IBZZ'="18" S Y="@111";91.01NAME OF SUBSCRIBER///1;90.03T;60.08SUBSCRIBER'S DOB///@;60.09SUBSCRIBER'S SSN///@;62.01///@;S Y="@112";@111;
  1. ;;91.01NAME OF SUBSCRIBER;90.03T;60.08SUBSCRIBER'S DOB;60.13SUBSCRIBER'S SEX;62.01T;@112;60.1:60.12;.03;60.15;60.16;61.01;62.02:62.06
  1. ;
  1. OTINS ; Insurance Company fields asked of non-MCCR users entering buffer data from options outside IB (20.01-20.04,21.01-21.06)
  1. ;;20.01:20.04;21.01;I X="" S Y="@111";21.02;I X="" S Y="@111";21.03;@111;21.04:21.06
  1. ;
  1. OTGRP ; Group/Plan fields asked of non-MCCR users entering buffer data from options outside IB (90.01,90.02,40.09) ;;Daou/EEN-adding BIN & PCN (40.1,40.11)
  1. ;;90.01;90.02;40.1;40.11;40.09
  1. ;
  1. OTPOL ; Patient Policy fields asked of non-MCCR users entering buffer data from options outside IB (60.02,60.03,90.03,60.05,60.06,91.01,60.08)
  1. ;;60.02;60.03;60.14PT. RELATIONSHIP TO INSURED;S IBZZ=X;90.03T;I IBZZ'="18" S Y="@111";91.01///1;60.08///@;60.09///@;62.01///@;S Y="@112";@111;91.01;60.08;60.13;62.01T;@112;60.15;60.16;62.02;62.03;62.04;62.05;62.06