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

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1IBCONS3 ;ALB/AAS - NSC W/INSURANCE OUTPUT, TRACKING INTEFACE ; 21-OCT-93
2 ;;2.0;INTEGRATED BILLING;**19,36,91,120**;21-MAR-94
3 ;
4TRACK ; -- Claims tracking interface for patients with insurance reports.
5 ;
6 I $D(ZTQUEUED),$$S^%ZTLOAD S (ZTSTOP,IBQUIT)=1
7 ;
8 N IBNO,IBTRN,IBXX
9 S IBRMARK=""
10 ; -- if there get reason not billable
11 I IBINPT D ;look for inpatient tracking records
12 .Q:'$G(IBADMVT)
13 .S IBTRN=$O(^IBT(356,"AD",+IBADMVT,0))
14 .Q:'$G(IBTRN)
15 .S IBRMARK=$$RMARK(IBTRN)
16 .Q
17 ;
18 I 'IBINPT D ;look for outpatient tracking records
19 .I $G(IBOE) S IBTRN=$O(^IBT(356,"ASCE",+IBOE,0))
20 .;Patch 36 if assoc stop code link to primary encounter IBOE
21 .I '$G(IBTRN) S IBXX=$$SCE^IBSDU(+IBOE,6) S:IBXX IBTRN=$O(^IBT(356,"ASCE",+IBXX,0))
22 .I $P($G(IBOE(1)),U,2),'($G(IBTRN)) N X,IBTMP F IBNO=1:1 Q:$G(IBOE(IBNO))="" F X=1:1 Q:($P(IBOE(IBNO),U,X)="")!($G(IBTRN)) D
23 ..S IBTMP=$P(IBOE(IBNO),U,X)
24 ..I $O(^IBT(356,"ASCE",+IBTMP,0)) S IBTRN=$O(^IBT(356,"ASCE",+IBTMP,0)) Q
25 .I '$G(IBTRN) D
26 ..N IBETYP S IBETYP=+$O(^IBE(356.6,"B","OUTPATIENT VISIT",0))
27 ..S X=$O(^IBT(356,"APTY",DFN,IBETYP,($P(I,".")-.0000001))) S:$P(X,".")=$P(I,".") IBTRN=$O(^(X,0))
28 .Q:'$G(IBTRN)
29 .S IBRMARK=$$RMARK(IBTRN)
30 .Q
31 ;
32 ; -- if not in ct and parameter set to add, add to ct. (INPT ONLY P120)
33 I IBINPT,'$G(IBTRN),$P(IBTRKR,"^",23) D ADD
34 ;
35TRACKQ Q
36 ;
37ADD ; -- if not there see if should add
38 ; if inpatient, not before ct start date, inpt tracking on
39 I IBINPT,I'<+IBTRKR,$P(IBTRKR,"^",2) D
40 .;
41 .Q:'$G(IBADMVT)
42 .N I,J,X,Y,DA,DR,DIE,DIC,IBETYP,IBADMDT,IBTRN
43 .S IBADMDT=$P(^DGPM(IBADMVT,0),"^")
44 .S IBETYP=+$O(^IBE(356.6,"B","INPATIENT ADMISSION",0))
45 .S IBTRN=$O(^IBT(356,"ASCH",+$$SCH^IBTRKR2(IBADMVT),0))
46 .D:'IBTRN ADDT^IBTUTL
47 .I IBTRN<1 Q
48 .S DA=IBTRN,DIE="^IBT(356,"
49 .L +^IBT(356,+IBTRN):10 I '$T Q
50 .S DR=$$ADMDR^IBTUTL(IBADMDT,IBETYP,IBADMVT,0)
51 .D ^DIE
52 .L -^IBT(356,+IBTRN)
53 .Q
54 ;
55 ; patch 120, removed add opt to CT from here to call tracker routine to add opt CT entries so will get all the non-billable checks
56ADDQ Q
57 ;
58RMARK(IBTRN) ; -- returns external reason not billable
59 Q $P($G(^IBE(356.8,+$P($G(^IBT(356,+$G(IBTRN),0)),"^",19),0)),"^")
Note: See TracBrowser for help on using the repository browser.