| 1 | IVMPINS ;ALB/CPM,PHH - INSURANCE EVENT DRIVER INTERFACE ; 01-MAY-94
 | 
|---|
| 2 |  ;;2.0;INCOME VERIFICATION MATCH;**9,94**; 21-OCT-94
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 | EN ; Queue transmission if an IVM patient's insurance status changes.
 | 
|---|
| 6 |  ;  Input:  DFN -- Pointer to the patient in file #2
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 |  N EVENTS
 | 
|---|
| 9 |  S EVENTS("IVM")=1
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  I '$G(DFN) G ENQ
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  ; - quit if invoked by the IVM insurance upload process
 | 
|---|
| 14 |  I $G(IVMINSUP) G ENQ
 | 
|---|
| 15 |  ;
 | 
|---|
| 16 |  ; - quit if the patient is not Cat C or Cat A
 | 
|---|
| 17 |  S IVMMT=$$LST^DGMTU(DFN)
 | 
|---|
| 18 |  I $P(IVMMT,"^",4)'="A",$P(IVMMT,"^",4)'="C" G ENQ
 | 
|---|
| 19 |  ;
 | 
|---|
| 20 |  ; - find the latest IVM case record, if it exists
 | 
|---|
| 21 |  S (IVMDA,IVMDT,X)=0
 | 
|---|
| 22 |  F  S X=$O(^IVM(301.5,"APT",DFN,X)) Q:'X  S IVMDT=X
 | 
|---|
| 23 |  I IVMDT S IVMDA=+$O(^IVM(301.5,"APT",DFN,IVMDT,0))
 | 
|---|
| 24 |  S IVMNEW='IVMDA
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 |  ; - determine changes in insurance status
 | 
|---|
| 27 |  S IVMINSP=$$PRIOR(IVMDA)
 | 
|---|
| 28 |  S IVMINSA=$$INSUR^IBBAPI(DFN)
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 |  ; - queue transmission if status has changed
 | 
|---|
| 31 |  I IVMDA,(IVMINSP&'IVMINSA)!('IVMINSP&IVMINSA=1) I $$SETSTAT^IVMPLOG(IVMDA,.EVENTS)
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  ; - queue transmission if Cat C pt w/o a case record has no insurance
 | 
|---|
| 34 |  I 'IVMDA,'IVMINSA,$P(IVMMT,"^",4)="C" S IVMDT=$$LYR^DGMTSCU1(+$P(IVMMT,"^",2)) I $$LOG^IVMPLOG(DFN,IVMDT,.EVENTS)
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 | ENQ K IVMDA,IVMDT,IVMINSA,IVMINSP,IVMMT,IVMNEW,X
 | 
|---|
| 37 |  Q
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  ;
 | 
|---|
| 40 | PRIOR(DA) ; Find insurance status from last transmission
 | 
|---|
| 41 |  ;  Input:  DA -- Pointer to the case record in file #301.5
 | 
|---|
| 42 |  ; Output:   0 -- No active insurance at last transmission
 | 
|---|
| 43 |  ;                (or could not identify last transmission)
 | 
|---|
| 44 |  ;           1 -- Had active insurance at last transmission
 | 
|---|
| 45 |  ;
 | 
|---|
| 46 |  N X,Y S (X,Y)=0
 | 
|---|
| 47 |  I $G(DA) F  S Y=$O(^IVM(301.6,"B",DA,Y)) Q:'Y  S X=Y
 | 
|---|
| 48 |  Q $S(X:+$P($G(^IVM(301.6,X,1)),"^",2),1:0)
 | 
|---|