BPSRPC04 ;AITC/PD - ECME TAS RPC - Test Extract Fields;01/15/2020
;;1.0;E CLAIMS MGMT ENGINE;**27**;JUN 2004;Build 15
;;Per VA Directive 6402, this routine should not be modified.
;
Q
;
; ---------------------------------------
;
N BPSCNT,BPSDATA,BPSFHIR,BPSFHIR1,BPSFLD,BPSI,BPSIEN
;
; Build BPSTMP array to include all fields
;
S BPSTMP("BilledAmount")=225.99
S BPSTMP("BillNumber")="KB12345"
S BPSTMP("BIN")=111111
S BPSTMP("ClaimID")="VA2019=2222222222=333333=4444444"
S BPSTMP("ClosedByUser")="User,Closed By"
S BPSTMP("ClosedDate")="2019-03-10"
S BPSTMP("ClosedReason")="NON COVERED DRUG PER PLAN"
S BPSTMP("CollectedAmount")=25.75
S BPSTMP("CompletedDate")="2019-03-11"
S BPSTMP("DispensingFee")=20.50
S BPSTMP("DispensingFeePaid")=15.25
S BPSTMP("Division")="CHEYENNE VAMC"
S BPSTMP("DrugClass")="PENICILLINS,AMINO DERIVATIVES"
S BPSTMP("DrugName")="AMOXICILLIN 250/CLAV K 125MG TAB"
S BPSTMP("ECMENumber")="000003333333"
S BPSTMP("ElapseTimeInSeconds")="4 sec"
S BPSTMP("Eligibility")="TRICARE"
S BPSTMP("FillLocation")="W"
S BPSTMP("FillType")="BB"
S BPSTMP("GroupID")="C1GRP NUM MCCF"
S BPSTMP("IngredientCost")=99.99
S BPSTMP("IngredientCostPaid")=75.65
S BPSTMP("InsuranceName")="AETNA US"
S BPSTMP("InsurancePaidAmount")=50.30
S BPSTMP("MultipleRejects")="Y"
S BPSTMP("NDC")="43598-0218-30"
S BPSTMP("OpenClosed")="C"
S BPSTMP("PatientID")="9999"
S BPSTMP("PatientName")="Name, Patient"
S BPSTMP("PatientPayAmount")=10.95
S BPSTMP("PayerResponse")="E REJECTED"
S BPSTMP("Prescriber")="LOCKET"
S BPSTMP("PrescriberID")="DB1316092638"
S BPSTMP("Quantity")=180
S BPSTMP("Refill")=0
S BPSTMP("Rejected")="REJ"
S BPSIEN=69
F BPSI=1:1:20 S BPSIEN=$O(^BPSF(9002313.93,BPSIEN)) S BPSDATA=^BPSF(9002313.93,BPSIEN,0) D
. S BPSTMP("RejectCode"_BPSI)=$P(BPSDATA,"^")
. S BPSTMP("RejectExplanation"_BPSI)=$P(BPSDATA,"^",2)
S BPSTMP("ReleasedDate")="2019-02-28"
S BPSTMP("ReturnStatus")="REJECTED"
S BPSTMP("ReversalMethod")="Auto"
S BPSTMP("ReversalReason")="RX DISCONTINUED"
S BPSTMP("RxCOB")="p"
S BPSTMP("RxNumber")=7777777
S BPSTMP("SiteName")="CHEYENNE VAH&ROC"
S BPSTMP("SiteNumber")="442"
S BPSTMP("Touched")=0
S BPSTMP("TransactionDate")="2019-02-27"
S BPSTMP("TransactionStatus")="DS/N"
S BPSTMP("TransactionType")="Rejected"
;
; Reformat BPSTMP array into BPSTMP1 to transform to JSON format
; BPSTMP1 will regroup fields by FHIR Resource
S BPSFLD=""
S BPSCNT=0
F S BPSFLD=$O(BPSTMP(BPSFLD)) Q:BPSFLD="" D
. ; Exclude field if value is nil
. I $G(BPSTMP(BPSFLD))="" Q
. S BPSFHIR1=""
. F BPSI=1:1 S BPSFHIR=$P($T(FHIR+BPSI),";;",2,99) Q:BPSFHIR=""!(BPSFHIR1'="") D
. . I BPSFLD=$P(BPSFHIR,";;") S BPSFHIR1=$P(BPSFHIR,";;",2)
. I BPSFHIR1="" S BPSFHIR1="Basic"
. S BPSCNT=BPSCNT+1
. S BPSTMP1("Bundle",BPSFHIR1,BPSCNT,BPSFLD)=BPSTMP(BPSFLD)
;
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSRPC04 2932 printed Dec 13, 2024@01:52:38 Page 2
BPSRPC04 ;AITC/PD - ECME TAS RPC - Test Extract Fields;01/15/2020
+1 ;;1.0;E CLAIMS MGMT ENGINE;**27**;JUN 2004;Build 15
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
+1 ; ---------------------------------------
+2 ;
+3 NEW BPSCNT,BPSDATA,BPSFHIR,BPSFHIR1,BPSFLD,BPSI,BPSIEN
+4 ;
+5 ; Build BPSTMP array to include all fields
+6 ;
+7 SET BPSTMP("BilledAmount")=225.99
+8 SET BPSTMP("BillNumber")="KB12345"
+9 SET BPSTMP("BIN")=111111
+10 SET BPSTMP("ClaimID")="VA2019=2222222222=333333=4444444"
+11 SET BPSTMP("ClosedByUser")="User,Closed By"
+12 SET BPSTMP("ClosedDate")="2019-03-10"
+13 SET BPSTMP("ClosedReason")="NON COVERED DRUG PER PLAN"
+14 SET BPSTMP("CollectedAmount")=25.75
+15 SET BPSTMP("CompletedDate")="2019-03-11"
+16 SET BPSTMP("DispensingFee")=20.50
+17 SET BPSTMP("DispensingFeePaid")=15.25
+18 SET BPSTMP("Division")="CHEYENNE VAMC"
+19 SET BPSTMP("DrugClass")="PENICILLINS,AMINO DERIVATIVES"
+20 SET BPSTMP("DrugName")="AMOXICILLIN 250/CLAV K 125MG TAB"
+21 SET BPSTMP("ECMENumber")="000003333333"
+22 SET BPSTMP("ElapseTimeInSeconds")="4 sec"
+23 SET BPSTMP("Eligibility")="TRICARE"
+24 SET BPSTMP("FillLocation")="W"
+25 SET BPSTMP("FillType")="BB"
+26 SET BPSTMP("GroupID")="C1GRP NUM MCCF"
+27 SET BPSTMP("IngredientCost")=99.99
+28 SET BPSTMP("IngredientCostPaid")=75.65
+29 SET BPSTMP("InsuranceName")="AETNA US"
+30 SET BPSTMP("InsurancePaidAmount")=50.30
+31 SET BPSTMP("MultipleRejects")="Y"
+32 SET BPSTMP("NDC")="43598-0218-30"
+33 SET BPSTMP("OpenClosed")="C"
+34 SET BPSTMP("PatientID")="9999"
+35 SET BPSTMP("PatientName")="Name, Patient"
+36 SET BPSTMP("PatientPayAmount")=10.95
+37 SET BPSTMP("PayerResponse")="E REJECTED"
+38 SET BPSTMP("Prescriber")="LOCKET"
+39 SET BPSTMP("PrescriberID")="DB1316092638"
+40 SET BPSTMP("Quantity")=180
+41 SET BPSTMP("Refill")=0
+42 SET BPSTMP("Rejected")="REJ"
+43 SET BPSIEN=69
+44 FOR BPSI=1:1:20
SET BPSIEN=$ORDER(^BPSF(9002313.93,BPSIEN))
SET BPSDATA=^BPSF(9002313.93,BPSIEN,0)
Begin DoDot:1
+45 SET BPSTMP("RejectCode"_BPSI)=$PIECE(BPSDATA,"^")
+46 SET BPSTMP("RejectExplanation"_BPSI)=$PIECE(BPSDATA,"^",2)
End DoDot:1
+47 SET BPSTMP("ReleasedDate")="2019-02-28"
+48 SET BPSTMP("ReturnStatus")="REJECTED"
+49 SET BPSTMP("ReversalMethod")="Auto"
+50 SET BPSTMP("ReversalReason")="RX DISCONTINUED"
+51 SET BPSTMP("RxCOB")="p"
+52 SET BPSTMP("RxNumber")=7777777
+53 SET BPSTMP("SiteName")="CHEYENNE VAH&ROC"
+54 SET BPSTMP("SiteNumber")="442"
+55 SET BPSTMP("Touched")=0
+56 SET BPSTMP("TransactionDate")="2019-02-27"
+57 SET BPSTMP("TransactionStatus")="DS/N"
+58 SET BPSTMP("TransactionType")="Rejected"
+59 ;
+60 ; Reformat BPSTMP array into BPSTMP1 to transform to JSON format
+61 ; BPSTMP1 will regroup fields by FHIR Resource
+62 SET BPSFLD=""
+63 SET BPSCNT=0
+64 FOR
SET BPSFLD=$ORDER(BPSTMP(BPSFLD))
if BPSFLD=""
QUIT
Begin DoDot:1
+65 ; Exclude field if value is nil
+66 IF $GET(BPSTMP(BPSFLD))=""
QUIT
+67 SET BPSFHIR1=""
+68 FOR BPSI=1:1
SET BPSFHIR=$PIECE($TEXT(FHIR+BPSI),";;",2,99)
if BPSFHIR=""!(BPSFHIR1'="")
QUIT
Begin DoDot:2
+69 IF BPSFLD=$PIECE(BPSFHIR,";;")
SET BPSFHIR1=$PIECE(BPSFHIR,";;",2)
End DoDot:2
+70 IF BPSFHIR1=""
SET BPSFHIR1="Basic"
+71 SET BPSCNT=BPSCNT+1
+72 SET BPSTMP1("Bundle",BPSFHIR1,BPSCNT,BPSFLD)=BPSTMP(BPSFLD)
End DoDot:1
+73 ;
+74 QUIT
+75 ;