| 1 | BPSOSQA ;BHAM ISC/FCS/DRS/DLF - ECME background, Part 1 ;06/02/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 |  ;
 | 
|---|
| 6 |  ; ONE59 - Validate BPS Transaction data
 | 
|---|
| 7 |  ; Input
 | 
|---|
| 8 |  ;   IEN59 - BPS Transaction
 | 
|---|
| 9 |  ;
 | 
|---|
| 10 | ONE59(IEN59) ;EP - from BPSOSIZ
 | 
|---|
| 11 |  ; Process this one IEN59
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  ; Initialize variables
 | 
|---|
| 14 |  N X1,RX,RXI,RTN
 | 
|---|
| 15 |  S X1=$G(^BPST(IEN59,1))
 | 
|---|
| 16 |  S RXI=$P(X1,U),RX=$P(X1,U,11),RTN=$T(+0)
 | 
|---|
| 17 |  ;
 | 
|---|
| 18 |  I RX="" D ERROR^BPSOSU(RTN,IEN59,106,"Prescription Number not found in Transaction") G END
 | 
|---|
| 19 |  I RXI="" D ERROR^BPSOSU(RTN,IEN59,107,"Fill Number not found in Transaction") G END
 | 
|---|
| 20 |  ; Create log entry
 | 
|---|
| 21 |  ; Needed for Turn-Around Stats - Do NOT delete/alter!!
 | 
|---|
| 22 |  D LOG^BPSOSL(IEN59,$T(+0)_"-Validating the BPS Transaction")
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  ; Check for existance of the prescription
 | 
|---|
| 25 |  I $$RXAPI1^BPSUTIL1(RX,.01,"I")="" D ERROR^BPSOSU(RTN,IEN59,101,"Missing RX # field .01") G END
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  ; If there is a refill, check for the existance of the refill
 | 
|---|
| 28 |  I RXI,$$RXSUBF1^BPSUTIL1(RX,52,52.1,RXI,.01,"I")="" D ERROR^BPSOSU(RTN,IEN59,102,"Missing RX Refill field .01") G END
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 |  ; Check for missing patient
 | 
|---|
| 31 |  I '$P(^BPST(IEN59,0),U,6) D ERROR^BPSOSU(RTN,IEN59,103,"Patient missing from BPS Transaction") G END
 | 
|---|
| 32 |  ;
 | 
|---|
| 33 |  ; Check for missing division
 | 
|---|
| 34 |  I '$P(X1,U,4) D ERROR^BPSOSU(RTN,IEN59,104,"Division missing from BPS Transaction") G END
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 |  ; Check for missing BPS Pharmacy
 | 
|---|
| 37 |  I '$P(X1,U,7)="" D ERROR^BPSOSU(RTN,IEN59,105,"ECME Pharmacy missing from BPS Transaction") G END
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  ; Check for missing insurance node
 | 
|---|
| 40 |  I '$D(^BPST(IEN59,10,1,0)) D ERROR^BPSOSU(RTN,IEN59,106,"Missing Insurance in BPST("_IEN59_",10,1,0)") G END
 | 
|---|
| 41 |  ;
 | 
|---|
| 42 |  ; If we got this far, we did not get an error
 | 
|---|
| 43 |  ; Change status to 30 (Waiting for packet build)
 | 
|---|
| 44 |  D SETSTAT^BPSOSU(IEN59,30)
 | 
|---|
| 45 |  ;
 | 
|---|
| 46 | END ; Common exit point
 | 
|---|
| 47 |  ;
 | 
|---|
| 48 |  ; Log the contents of Transaction record
 | 
|---|
| 49 |  D LOG^BPSOSL(IEN59,$T(+0)_"-Contents of ^BPST("_IEN59_"):")
 | 
|---|
| 50 |  D LOG59(IEN59)
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 |  ; If there are claims at 30%, fire up the packet process
 | 
|---|
| 53 |  I $O(^BPST("AD",30,0)) D TASK
 | 
|---|
| 54 |  Q
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  ;
 | 
|---|
| 57 | LOG59(IEN59) ; Log the IEN59 array
 | 
|---|
| 58 |  N A
 | 
|---|
| 59 |  M A=^BPST(IEN59)
 | 
|---|
| 60 |  D LOGARRAY^BPSOSL(IEN59,"A")
 | 
|---|
| 61 |  Q
 | 
|---|
| 62 |  ;
 | 
|---|
| 63 | TASK ;EP - from BPSOSQ2,BPSOSQ4,BPSOSRB
 | 
|---|
| 64 |  N X,%DT,Y S X="N",%DT="ST" D ^%DT
 | 
|---|
| 65 |  D TASKAT(Y)
 | 
|---|
| 66 |  Q
 | 
|---|
| 67 |  ;
 | 
|---|
| 68 | TASKAT(ZTDTH) ;EP - from BPSOSQ4 (requeue if insurer is sleeping)
 | 
|---|
| 69 |  N ZTRTN,ZTIO
 | 
|---|
| 70 |  S ZTRTN="PACKETS^BPSOSQ2",ZTIO=""
 | 
|---|
| 71 |  D ^%ZTLOAD
 | 
|---|
| 72 |  Q
 | 
|---|