source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCU5.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1IBCU5 ;ALB/AAS - MCCR MAILING ADDRESS UTILITY ROUTINE ;26-FEB-90
2 ;;2.0;INTEGRATED BILLING;**8,52,80,117,51,206**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;MAP TO DGCRU5
6 ;
7EN ;Entry from X-REF from who's responsible
8 ;doesn't set primary insurance field, must be second trigger.
9 S X=$P(^DGCR(399,DA,0),"^",11)
10 I X="p" D MAILP G ENQ
11 I X="o" S DGTAG=$S('$D(^DGCR(399,DA,"M")):"MAILP",'$P(^("M"),"^",11):"MAILP",'$D(^DIC(4,$P(^("M"),"^",11),0)):"MAILP",1:"MAILIN") D @DGTAG G ENQ
12 I X="i",+$G(^DGCR(399,DA,"MP")) D MAILA G ENQ
13ENQ K DGTAG Q
14 ;
15EN1 ;Now Trigger of primary insurance policy from who's responsible
16 ;if only one active policy
17 ;; old Trigger of primary insurer from who's responsible
18 ;Only should be called if primary insurer is null (condition of trigger)
19 ;return ifn of insurer in X
20 ;
21 S X=""
22 I $S('$D(IBAC):1,IBAC=6:1,1:0) Q
23 ;
24 S IBINDT=$S($G(IBIDS(151)):IBIDS(151),$P($G(^DGCR(399,DA,"U")),"^"):$P($G(^DGCR(399,DA,"U")),"^"),1:DT)
25 D ALL^IBCNS1(DFN,"IBDD",2,IBINDT)
26 I $G(IBDD(0))=1 S X=+$O(IBDD(0)) G EN1Q
27 ;
28 ;S IBOUTP=1,IBINDT=$S($G(IBIDS(151)):IBIDS(151),$P($G(^DGCR(399,DA,"U")),"^"):$P($G(^DGCR(399,DA,"U")),"^"),1:DT)
29 ;D ^IBCNS I IBINS S X=IBDD($O(IBDD(0))) S:$O(IBDD(+X)) X="" S X=$S($D(^DIC(36,+X,0)):+X,1:"") G EN1Q
30 S X=""
31EN1Q K IBDD,IBINS,IBIN Q
32 ;
33MAILA ;Store Mailing Address for Bill Payer Carrier (and if not copying bill or bill not authorized,
34 ; insert Attending Physican Id [36,.1] into Form Locator 92 [399,213]
35 ;
36 S DA=$S('$D(DA):IBIFN,DA']"":IBIFN,1:DA)
37 G MAILQ:$P(^DGCR(399,DA,0),U,11)="p" ; Patient is responsible for bill
38 G MAILQ:$P(^DGCR(399,DA,0),U,11)="o" ; Other party is responsible for bill
39 ;
40 S IB01=+$G(^DGCR(399,DA,"MP"))
41 G MAILQ:'$D(^DIC(36,+IB01,0)) ; Bad insurance data
42 ;
43 S IB02=$$ADD^IBCNADD(DA)
44 ;
45 D UPDMA(DA,IB01,IB02)
46 ;
47 I '$D(IBCAN)!($G(IBAC)<3) S $P(^DGCR(399,DA,"U1"),U,13)=$P($G(^DIC(36,+IB01,0)),U,10)
48 ;
49MAILQ K IB01,IB02,IB03 Q
50 ;
51UPDMA(DA,IB01,IB02) ; Update insurance company mailing address in file 399
52 ; DA = bill ifn
53 ;IB02 = string returned from call to ADD^IBCNADD
54 ;IB01 = insurance company ifn
55 S $P(^DGCR(399,DA,"M"),"^",4,9)=$E($P($G(^DIC(36,+IB01,0)),"^",1),1,30)_"^"_$P(IB02,"^",1)_"^"_$P(IB02,"^",2)_"^"_$P(IB02,"^",4)_"^"_$P(IB02,"^",5)_"^"_$P(IB02,"^",6)
56 ;
57 ; -- if send bill to employer, piece 7 = name
58 I $P(IB02,"^",8)'="",+$P(IB02,"^",8)'=$P(IB02,"^",8) S $P(^DGCR(399,DA,"M"),"^",4)=$P(IB02,"^",8)
59 ;
60 S $P(^DGCR(399,DA,"M1"),U,1)=$P(IB02,U,3)
61 Q
62 ;
63MAILIN ;Store Mailing Address for Institution
64 S DA=$S('$D(DA):IBIFN,DA']"":IBIFN,1:DA),X=$P(^DGCR(399,DA,"M"),"^",11) G:X']"" MAILINQ G:'$D(^DIC(4,X,0)) MAILINQ
65 S IB01=^DIC(4,X,0),IB02=$S($D(^(1)):^(1),1:"")
66 S $P(^DGCR(399,IBIFN,"M"),"^",4,9)=$P(IB01,U,1)_"^"_$P(IB02,U,1)_"^"_$P(IB02,U,2)_"^"_$P(IB02,U,3)_"^"_$P(IB01,U,2)_"^"_$TR($P(IB02,U,4),"-")
67 S $P(^DGCR(399,IBIFN,"M1"),"^",1)=""
68MAILINQ K IB01,IB02,IB03 Q
69 ;
70MAILP ;Store Patient Mailing address
71 N DFN,VAPA,DGNAM,IBCONF
72 S DA=$S('$D(DA):IBIFN,DA']"":IBIFN,1:DA)
73 S DFN=$P(^DGCR(399,DA,0),"^",2),VAPA("P")="" D DEM^VADPT,ADD^VADPT
74 S IBCONF=$S('$G(VAPA(12)):0,$P($G(VAPA(22,3)),U,3)'="Y":0,1:1) ; Confidential Address
75 S DGNAM=$P(VADM(1),",",2)_" "_$P(VADM(1),",",1)
76 S DGNAM=$S($E(VADM(5))'="F":"MR.",'$D(^DIC(11,+$P(^DPT(DFN,0),"^",5),0)):"MS.","DMW"[$E(^DIC(11,$P(^DPT(DFN,0),"^",5),0)):"MRS.",1:"MS.")_DGNAM
77 S $P(^DGCR(399,DA,"M"),"^",4)=DGNAM
78 I IBCONF D ; use conf. address for mailing
79 . S $P(^DGCR(399,DA,"M"),"^",5,9)=VAPA(13)_"^"_VAPA(14)_"^"_VAPA(16)_"^"_+VAPA(17)_"^"_$P(VAPA(18),U,1)
80 . S $P(^DGCR(399,DA,"M1"),"^",1)=VAPA(15)
81 I 'IBCONF D
82 . S $P(^DGCR(399,DA,"M"),"^",5,9)=VAPA(1)_"^"_VAPA(2)_"^"_VAPA(4)_"^"_+VAPA(5)_"^"_$P(VAPA(11),U,1)
83 . S $P(^DGCR(399,DA,"M1"),"^",1)=VAPA(3)
84MAILPQ Q
85 ;
86INSUR ;
87 Q
88DEL S $P(^DGCR(399,DA,"M"),"^",4,9)="^^^^^",$P(^("M1"),"^",1)=""
89 Q
Note: See TracBrowser for help on using the repository browser.