| 1 | IVMPLOG2 ;ALB/CJM - API for IVM PATIENT file; 4-SEP-97
 | 
|---|
| 2 |  ;;2.0;INCOME VERIFICATION MATCH;**9,17**; 21-OCT-94
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ;
 | 
|---|
| 6 | CLOSE(IEN,REASON,SOURCE) ;
 | 
|---|
| 7 |  ;Description: Sets the value of the STOP FLAG field to 1 for a
 | 
|---|
| 8 |  ;particular record in  the IVM PATIENT file, as well as setting related
 | 
|---|
| 9 |  ;fields. This has the effect of stopping updates to a particular
 | 
|---|
| 10 |  ;IVM PATIENT record for some types of events, but not for enrollment
 | 
|---|
| 11 |  ;events.
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  ;Input:
 | 
|---|
| 14 |  ;  IEN - internal entry number of a record in the IVM PATIENT file.
 | 
|---|
| 15 |  ;  REASON - ien of record in the IVM CASE CLOSURE REASON file (#301.93)
 | 
|---|
| 16 |  ;  SOURCE - set of codes, 1= IVM CENTER (HEC), 2 = DHCP (local site)
 | 
|---|
| 17 |  ;
 | 
|---|
| 18 |  ;Output:  
 | 
|---|
| 19 |  ;  Function Value - 1 on success, 0 on failure.
 | 
|---|
| 20 |  ;
 | 
|---|
| 21 |  N DATA,ERROR
 | 
|---|
| 22 |  I $G(REASON)'="",'$$TESTVAL^DGENDBS(301.5,1.01,REASON) Q 0
 | 
|---|
| 23 |  I $G(SOURCE)'="",'$$TESTVAL^DGENDBS(301.5,1.02,SOURCE) Q 0
 | 
|---|
| 24 |  Q:'$$LOCK^IVMPLOG($G(IEN)) 0
 | 
|---|
| 25 |  S DATA(.04)=1
 | 
|---|
| 26 |  S DATA(1.01)=$G(REASON)
 | 
|---|
| 27 |  S DATA(1.02)=$G(SOURCE)
 | 
|---|
| 28 |  S DATA(1.03)=$$NOW^XLFDT
 | 
|---|
| 29 |  S ERROR=$$UPD^DGENDBS(301.5,IEN,.DATA)
 | 
|---|
| 30 |  D UNLOCK^IVMPLOG(IEN)
 | 
|---|
| 31 |  Q ERROR
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 | DELETE(IEN) ;
 | 
|---|
| 34 |  ;Description: Used to delete a record in the IVM PATIENT file.
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 |  ;Input:
 | 
|---|
| 37 |  ;   IEN - the internal entry number for a record in the IVM PATIENT file
 | 
|---|
| 38 |  ;Output:
 | 
|---|
| 39 |  ;  Function Value - 1 on success, 0 on failure
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  Q:'$G(IEN) 1
 | 
|---|
| 42 |  ;
 | 
|---|
| 43 |  Q:'$$LOCK^IVMPLOG(IEN) 0
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 |  N DIK,DA
 | 
|---|
| 46 |  S DIK="^IVM(301.5,"
 | 
|---|
| 47 |  S DA=IEN
 | 
|---|
| 48 |  D ^DIK
 | 
|---|
| 49 |  D UNLOCK^IVMPLOG(IEN)
 | 
|---|
| 50 |  Q 1
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 | ADDFUTR(MTIEN) ;
 | 
|---|
| 53 |  ;Adds a future test to the IVM Patient file.  MTIEN is the ien
 | 
|---|
| 54 |  ;of the future test in the Annual Means Test file
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  Q:'$G(MTIEN)
 | 
|---|
| 57 |  ;
 | 
|---|
| 58 |  N NODE,DFN,DATE,IVMPAT,DATA,YEAR,TYPE
 | 
|---|
| 59 |  S NODE=$G(^DGMT(408.31,MTIEN,0))
 | 
|---|
| 60 |  S DATE=+NODE
 | 
|---|
| 61 |  Q:'DATE
 | 
|---|
| 62 |  S YEAR=($E(DATE,1,3)-1)
 | 
|---|
| 63 |  S DFN=$P(NODE,"^",2)
 | 
|---|
| 64 |  Q:('DFN)
 | 
|---|
| 65 |  S TYPE=$P(NODE,"^",19)
 | 
|---|
| 66 |  I TYPE'=1,TYPE'=2 Q
 | 
|---|
| 67 |  S IVMPAT=$$LOG^IVMPLOG(DFN,YEAR)
 | 
|---|
| 68 |  Q:'IVMPAT
 | 
|---|
| 69 |  S:(TYPE=1) DATA(.06)=MTIEN
 | 
|---|
| 70 |  S:(TYPE=2) DATA(.07)=MTIEN
 | 
|---|
| 71 |  I $$UPD^DGENDBS(301.5,IVMPAT,.DATA)
 | 
|---|
| 72 |  Q
 | 
|---|