| 1 | BPSOSL ;BHAM ISC/FCS/DRS/DLF - Logging ;06/01/2004 | 
|---|
| 2 | ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | Q | 
|---|
| 5 | ; Entry Points: | 
|---|
| 6 | ;   LOG  - Log a message | 
|---|
| 7 | ;   LOG2CLM - Log a message to all transactions associated with a claim | 
|---|
| 8 | ;   LOG2LIST - Log a message to all transactions in RXILIST | 
|---|
| 9 | ;   LOGARRAY - Log array data into the transaction | 
|---|
| 10 | ;   LOGARAY2 - Log array data into all transactions associated with a claim | 
|---|
| 11 | ; | 
|---|
| 12 | ; SLOT is usually a BPS Transaction, but can also be a communication log | 
|---|
| 13 | ;   The only communication log currently is for purging (format is DT+.5) | 
|---|
| 14 | ; | 
|---|
| 15 | ; LOG - Add an entry to BPS LOG | 
|---|
| 16 | ; Input | 
|---|
| 17 | ;   SLOT - Slot to write message (required) | 
|---|
| 18 | ;   TEXT - Message text (required) | 
|---|
| 19 | ;   SPECIAL - Special processing (add date and/or time to TEXT | 
|---|
| 20 | ;             If it contains a 'D', add Date | 
|---|
| 21 | ;             If it contains a 'T', add time | 
|---|
| 22 | LOG(SLOT,TEXT,SPECIAL) ; | 
|---|
| 23 | ; Check parameters | 
|---|
| 24 | I $G(SLOT)="" Q | 
|---|
| 25 | I $G(TEXT)="" Q | 
|---|
| 26 | ; | 
|---|
| 27 | ; Do SPECIAL processing | 
|---|
| 28 | I $G(SPECIAL)]"",SPECIAL["D"!(SPECIAL["T") D | 
|---|
| 29 | . N %,%H,%I,X,Y D NOW^%DTC S Y=% X ^DD("DD") | 
|---|
| 30 | . I SPECIAL'["D" S Y=$P(Y,"@",2) | 
|---|
| 31 | . I SPECIAL'["T" S Y=$P(Y,"@") | 
|---|
| 32 | . S TEXT=TEXT_" - "_Y | 
|---|
| 33 | ; | 
|---|
| 34 | ; Initialize variables | 
|---|
| 35 | N FN,FDA,LOGIEN,IEN,MSG,NOW | 
|---|
| 36 | S FN=9002313.12,NOW=$$NOW^XLFDT() | 
|---|
| 37 | ; | 
|---|
| 38 | ; If SLOT not defined, create it and then check for errors | 
|---|
| 39 | S LOGIEN=$O(^BPS(FN,"B",SLOT,"")) | 
|---|
| 40 | I 'LOGIEN D | 
|---|
| 41 | . S FDA(FN,"+1,",.01)=SLOT | 
|---|
| 42 | . D UPDATE^DIE("","FDA","IEN","MSG") | 
|---|
| 43 | . S LOGIEN=$G(IEN(1)) | 
|---|
| 44 | I 'LOGIEN!$D(MSG) Q | 
|---|
| 45 | ; | 
|---|
| 46 | ; Update LAST UPDATE field | 
|---|
| 47 | K FDA,MSG | 
|---|
| 48 | S FDA(FN,LOGIEN_",",.02)=NOW | 
|---|
| 49 | D FILE^DIE("","FDA","MSG") | 
|---|
| 50 | I $D(MSG) Q | 
|---|
| 51 | ; | 
|---|
| 52 | ; Create the multiple | 
|---|
| 53 | K FDA | 
|---|
| 54 | S FN=9002313.1201 | 
|---|
| 55 | S FDA(FN,"+1,"_LOGIEN_",",.01)=NOW | 
|---|
| 56 | S FDA(FN,"+1,"_LOGIEN_",",1)=$TR($E(TEXT,1,200),"^","~") | 
|---|
| 57 | D UPDATE^DIE("","FDA") | 
|---|
| 58 | Q | 
|---|
| 59 | ; | 
|---|
| 60 | ; LOG2CLM - Write MSG to log file for all BPS Transactions associated | 
|---|
| 61 | ;   with the claim | 
|---|
| 62 | LOG2CLM(IEN02,MSG) ; | 
|---|
| 63 | N IEN59 S IEN59=0 | 
|---|
| 64 | F  S IEN59=$O(^BPST("AE",IEN02,IEN59)) Q:'IEN59  D LOG(IEN59,MSG) | 
|---|
| 65 | Q | 
|---|
| 66 | ; | 
|---|
| 67 | ; LOG2LIST - Write MSG to the log files of all in RXILIST(*) | 
|---|
| 68 | ; Assumes RXILIST exists | 
|---|
| 69 | LOG2LIST(MSG) ; | 
|---|
| 70 | N IEN59 | 
|---|
| 71 | S IEN59=0 | 
|---|
| 72 | F  S IEN59=$O(RXILIST(IEN59)) Q:'IEN59  D LOG(IEN59,MSG) | 
|---|
| 73 | Q | 
|---|
| 74 | ; | 
|---|
| 75 | ; LOGARRAY - Log an array | 
|---|
| 76 | LOGARRAY(SLOT,ROOT,MAX) ; | 
|---|
| 77 | N REF S REF=ROOT | 
|---|
| 78 | N COUNT S COUNT=0 | 
|---|
| 79 | I '$D(MAX) S MAX=100 | 
|---|
| 80 | I $D(@REF)#10'=1 S REF=$Q(@REF) | 
|---|
| 81 | F  Q:REF=""  D  Q:'MAX | 
|---|
| 82 | . D LOG(SLOT,REF_"="_@REF) | 
|---|
| 83 | . S COUNT=COUNT+1 | 
|---|
| 84 | . S REF=$Q(@REF) | 
|---|
| 85 | . S MAX=MAX-1 | 
|---|
| 86 | I 'MAX,REF]"" D LOG(SLOT,"More of "_ROOT_" to log, but max reached") | 
|---|
| 87 | I 'COUNT D LOG(SLOT,"Nothing found in "_ROOT) | 
|---|
| 88 | Q | 
|---|
| 89 | ; | 
|---|
| 90 | ; LOGARAY2 - Log an array to the BPS Transactions associated with a claim | 
|---|
| 91 | LOGARAY2(IEN02,ROOT,MAX) ; | 
|---|
| 92 | N IEN59 | 
|---|
| 93 | S IEN59=0 | 
|---|
| 94 | F  S IEN59=$O(^BPST("AE",IEN02,IEN59)) Q:'IEN59  D LOGARRAY(IEN59,ROOT,MAX) | 
|---|
| 95 | Q | 
|---|