source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNBU1.m@ 1800

Last change on this file since 1800 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1IBCNBU1 ;ALB/ARH-Ins Buffer: Utilities ;1 Jun 97
2 ;;2.0;INTEGRATED BILLING;**82,184,263**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5BUFFER(DFN) ; returns IFN of first buffer entry found for the patient, 0 otherwise
6 Q +$O(^IBA(355.33,"C",+$G(DFN),0))
7 ;
8SELINS() ; user select an insurance company
9 N IBX,DIE,DTOUT,DUOUT,DIC,X,Y S IBX=0
10 S DIC="^DIC(36,",DIC(0)="AEQ",DIC("A")="Select INSURANCE COMPANY: ",DIC("S")="I '$P(^(0),U,5)" D ^DIC
11 I +Y>0 S IBX=Y
12 Q IBX
13 ;
14SELGRP(IBINSDA) ; given a specific insurance company, allow user to choose a group/plan
15 N IBX,DIE,DTOUT,DUOUT,DIC,X,Y,IBINSNM S IBX=0
16 S IBINSNM=$P($G(^DIC(36,+IBINSDA,0)),U,1)
17 W !,IBINSNM
18 S X=IBINSNM,DIC="^IBA(355.3,",DIC(0)="EQ",DIC("S")="I +^(0)="_+IBINSDA_"&('$P(^(0),U,11))" D ^DIC
19 I +Y>0 S IBX=Y
20 Q IBX
21 ;
22SELEXT(DFN) ; user select existing ins co, group, and if the patient is a member of the group also return the policy
23 N IBX,IBINSDA,IBGRPDA,IBPOLDA S (IBINSDA,IBGRPDA,IBPOLDA)=""
24 S IBINSDA=$$SELINS() S IBX=+IBINSDA
25 I +IBINSDA S IBGRPDA=$$SELGRP(+IBINSDA) I +IBGRPDA S IBX=IBX_U_+IBGRPDA
26 I +IBGRPDA,+$G(DFN) S IBPOLDA=$$PTGRP(DFN,IBINSDA,IBGRPDA) I +IBPOLDA S IBX=IBX_U_+IBPOLDA
27 Q IBX
28 ;
29PTGRP(DFN,IBINSDA,IBGRPDA) ; return policy ifn if patient is a member of this group plan
30 N IBX,IBY S IBX=0,DFN=+$G(DFN),IBINSDA=+$G(IBINSDA),IBGRPDA=+$G(IBGRPDA)
31 S IBY=0 F S IBY=$O(^DPT(DFN,.312,"B",IBINSDA,IBY)) Q:'IBY I +$P($G(^DPT(DFN,.312,IBY,0)),U,18)=IBGRPDA S IBX=IBY
32 Q IBX
33 ;
34DISPBUF(IBBUFDA) ; display summary info on a buffer entry
35 ;
36 Q:'$G(IBBUFDA)
37 N IB0,IB60 S IB0=$G(^IBA(355.33,IBBUFDA,0)) Q:IB0="" S IB60=$G(^IBA(355.33,IBBUFDA,60))
38 ;
39 W !,"--------------------------------------------------------------------------------"
40 W !,?2,"Entered: ",?15,$$FMTE^XLFDT(+IB0,2),?50,"Source: ",?60,$$EXPAND^IBTRE(355.33,.03,$P(IB0,U,3))
41 W !,?2,"Entered By: ",?15,$$EXPAND^IBTRE(355.33,.02,+$P(IB0,U,2)),?50,"Verified: ",?60,$$FMTE^XLFDT($P(IB0,U,10),2)
42 I +$P(IB0,U,10) W !,?50,"Verif By: ",?60,$E($$EXPAND^IBTRE(355.33,.11,$P(IB0,U,11)),1,20)
43 W !!,?2,"Patient: ",?15,$$EXPAND^IBTRE(355.33,60.01,$P(IB60,U,1)),?50,"Sub Id: ",?60,$P(IB60,U,4)
44 W !,?2,"Insurance: ",?15,$P($G(^IBA(355.33,+IBBUFDA,20)),U,1),?50,"Group #: ",?60,$P($G(^IBA(355.33,+IBBUFDA,40)),U,3)
45 W !,?15,$P($G(^IBA(355.33,+IBBUFDA,21)),U,1)
46 W !,"--------------------------------------------------------------------------------"
47 Q
48 ;
49LOCK(IBBUFDA,DISP,TO) ; return true if able to lock the buffer entry, if not an DISP is true then will display a message
50 ; TO - lock attempt time out & hang time in seconds, default to 4
51 N IBX S IBX=0
52 S TO=$G(TO,4)
53 I +$G(IBBUFDA) L +^IBA(355.33,+IBBUFDA):TO I +$T S IBX=1
54 I 'IBX,+$G(DISP) W !!,"Another user is currently editing/processing this entry, please try again later.",! H TO
55 Q IBX
56 ;
57UNLOCK(IBBUFDA) ; unlock a Buffer entry
58 L -^IBA(355.33,+IBBUFDA)
59 Q
60 ;
61DICINS(INSNAME,IBSCACT,IBLISTN) ; user search/selection of existing Insurance Company Names, does not list duplicates, based on names and synonyms
62 ;
63 ; Input parameters
64 ; INSNAME - user input; partial name match of insurance company
65 ; IBSCACT - 0/1 flag indicating if inactive insurance companies
66 ; should get screened out during the list building
67 ; Default is 0 (no screen)
68 ; IBLISTN - number of entries to display in the lister before
69 ; giving the user a chance to select. Default is 4.
70 ; Output
71 ; returns Ins name, or -1 if ^, or 0 if none selected
72 ;
73 S IBSCACT=$G(IBSCACT,0) ; flag to screen out inactive ins
74 S IBLISTN=$G(IBLISTN,4) ; number of list entries before user selection
75 ;
76 N IBX,IBINB,IBCX,IBSEL,IBXRF,IBNAME,IBSYNM,IBCNT,IBC1,IBINSIEN,IBLINE
77 S IBSEL=0 K ^TMP($J,"IBINSS"),^TMP($J,"IBINSSB") I INSNAME="" G DINSQ
78 ;
79 S INSNAME=$$UP^XLFSTR(INSNAME),IBX=$L(INSNAME),IBINB=$E(INSNAME,1,(IBX-1))_$C($A($E(INSNAME,IBX))-1)_"~"
80 ;
81 F IBCX="C","B" S IBXRF=IBINB D
82 . F S IBXRF=$O(^DIC(36,IBCX,IBXRF)) Q:IBXRF=""!($E(IBXRF,1,IBX)'=INSNAME) D
83 .. S IBINSIEN=0
84 .. F S IBINSIEN=+$O(^DIC(36,IBCX,IBXRF,IBINSIEN)) Q:'IBINSIEN D
85 ... I '$D(^DIC(36,IBINSIEN,0)) Q ; bad xref entry?
86 ... I IBSCACT,$P($G(^DIC(36,IBINSIEN,0)),U,5) Q ; inactive
87 ... I IBSCACT,$P($G(^DIC(36,IBINSIEN,5)),U,1) Q ; scheduled for deletion
88 ... S IBNAME=$P($G(^DIC(36,IBINSIEN,0)),U,1)
89 ... I IBNAME="" Q
90 ... I $D(^TMP($J,"IBINSSB",IBNAME)) Q
91 ... S ^TMP($J,"IBINSSB",IBNAME)=$S(IBNAME=IBXRF:"",1:IBXRF)
92 ... Q
93 ;
94 S IBCNT=0,IBX="" F S IBX=$O(^TMP($J,"IBINSSB",IBX)) Q:IBX="" S IBCNT=IBCNT+1,^TMP($J,"IBINSS",IBCNT)=IBX
95 ;
96 S (IBCNT,IBC1)=0 F S IBCNT=$O(^TMP($J,"IBINSS",IBCNT)) Q:'IBCNT D I +IBSEL Q
97 . S IBNAME=^TMP($J,"IBINSS",IBCNT) Q:IBNAME="" S IBSYNM=$G(^TMP($J,"IBINSSB",IBNAME))
98 . S IBLINE=$J(IBCNT,7)_" "_$$FO^IBCNEUT1(IBNAME,40)_IBSYNM
99 . DO EN^DDIOL(IBLINE)
100 . S IBC1=IBC1+1 I '(IBCNT#IBLISTN) S IBSEL=$$DIR(IBC1)
101 . Q
102 ;
103 I 'IBSEL,+(IBC1#IBLISTN) S IBSEL=$$DIR(IBC1)
104 ;
105 I IBSEL>0 S IBSEL=$G(^TMP($J,"IBINSS",IBSEL))
106 ;
107DINSQ K ^TMP($J,"IBINSS"),^TMP($J,"IBCNSSB")
108 Q IBSEL
109 ;
110DIR(MAX) ; DIR call for DICINS search for insurance company name
111 N DIR,DIRUT,DTOUT,DUOUT,IBX,X,Y S IBX=0,DIR(0)="LOA^1:"_MAX_"^K:X'>0!(X>"_MAX_") X",DIR("A")="CHOOSE 1-"_MAX_": "
112 I $G(MAX)>0 D ^DIR K DIR S IBX=$S($D(DTOUT)!$D(DUOUT):-1,+Y:+Y,1:0)
113 Q IBX
114 ;
115DICBUF(INSNAME,DFN,IBDUZ) ; display list of editable buffer entries based on insurance name, may specify patient and/or enterer
116 ; (non-MCCR people: only the person that created an entry should be able to edit it, everyone else should create new ones)
117 N X,Y,IBX,DIC,DA,DR,DIR,DIRUT,DTOUT,DUOUT,D S IBX=0
118 ;
119 S DIC("W")="W "" "",$P($G(^(20)),U,1),"" "",$P($G(^(21)),U,1)"
120 S DIC("S")="I $P(^(0),U,4)=""E""&('$P(^(0),U,10))" S:+$G(IBDUZ) DIC("S")=DIC("S")_"&(+$P(^(0),U,2)="_IBDUZ_")" S:+$G(DFN) DIC("S")=DIC("S")_"&(+$G(^(60))="_DFN_")"
121 S DIC="^IBA(355.33,",DIC(0)="EM",X=$$UP^XLFSTR($G(INSNAME)),D="D" D IX^DIC I '$D(DTOUT),'$D(DUOUT),+Y>0 S IBX=+Y
122 Q IBX
Note: See TracBrowser for help on using the repository browser.