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

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1IBCNSU3 ;ALB/TMP - Functions for billing decisions; 08-AUG-95
2 ;;2.0;INTEGRATED BILLING;**43,80**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5PTCOV(DFN,IBVDT,IBCAT,ANYINS) ; Determine if patient is covered for coverage category on a visit dt
6 ; Function returns 1 if covered, 0 if not covered
7 ; DFN - ifn of patient (req)
8 ; IBVDT - fileman format visit date (req)
9 ; IBCAT - entry in file 355.31 limitation of coverage category (req)
10 ; ANYINS - optional parameter, but if passed by reference, returns 0 if
11 ; no active insurance at all and 1 if any active insurance found
12 N IBCOV,IBDD,PLAN,POLCY
13 S (IBCOV,ANYINS)=0
14 I $G(DFN)=""!($G(IBCAT)="")!($G(IBVDT)="") G PTCOVQ ; Required fields not present
15 S IBCAT=$O(^IBE(355.31,"B",IBCAT,"")) G:IBCAT="" PTCOVQ
16 S IBVDT=IBVDT\1
17 D ALL^IBCNS1(DFN,"IBDD",1,IBVDT) ;All active ins policies returned in IBDD array
18 S ANYINS=($O(IBDD(0))'="") ;Set flag for any active insurance found
19 S POLCY=0 F S POLCY=$O(IBDD(POLCY)) Q:'POLCY D Q:IBCOV
20 .S PLAN=$P($G(IBDD(POLCY,0)),U,18) Q:PLAN=""
21 .S IBCOV=$$PLCOV(PLAN,IBVDT,IBCAT)
22 .I 'IBCOV,$D(^IBA(355.7,"APP",DFN,POLCY,+$P($G(^IBE(355.31,+IBCAT,0)),U,3)))'=0 S IBCOV=1
23PTCOVQ Q IBCOV
24 ;
25PLCOV(IBPL,IBVDT,IBCAT,COMMENT) ; Determine if a specific plan covers a category of coverage as of a date and returns comments
26 ; IBPL - pointer to file 355.3 group insurance plan (req)
27 ; IBVDT - fileman format visit date (req)
28 ; IBCAT - pointer to file 355.31 limitation of coverage category (req)
29 ; COMMENT - if passed by reference and the coverage is conditional will contain limitation comments
30 N CATLIM,X,Y K COMMENT
31 S CATLIM=$O(^IBA(355.32,"APCD",IBPL,IBCAT,+$O(^IBA(355.32,"APCD",IBPL,IBCAT,-(IBVDT+1))),""))
32 S X=$S(CATLIM="":1,1:+$P($G(^IBA(355.32,CATLIM,0)),U,4))
33 I X>1 S COMMENT=CATLIM,Y=0 F S Y=$O(^IBA(355.32,CATLIM,2,Y)) Q:'Y S COMMENT(Y)=$G(^IBA(355.32,CATLIM,2,Y,0))
34 Q X
35 ;
36RIDERS(DFN,IBCDFN,RIDERS) ; Returns all Riders (355.7) associated with a patient's policy in array if RIDERS is passed by reference
37 N Y K RIDERS
38 I +$G(DFN),+$G(IBCDFN) S Y=0 F S Y=$O(^IBA(355.7,"APP",DFN,IBCDFN,Y)) Q:'Y S RIDERS(Y)=$P($G(^IBE(355.6,Y,0)),U,1)
39 Q
Note: See TracBrowser for help on using the repository browser.