source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSNCPD1.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 7.1 KB
RevLine 
[613]1BPSNCPD1 ;BHAM ISC/LJE - Pharmacy API part 2 ;06/16/2004
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,3,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ; External reference to $$NCPDPQTY^PSSBPSUT supported by IA4992
6 ;
7 ; Due to space considerations, these comments were moved from BPSNPCPD
8 ; to this routine.
9 ;
10 ; ------------------ Beginning of BPSNCPDP comments ------------------
11 ;Input
12 ; BRXIEN = Prescription IEN
13 ; BFILL = Fill Number
14 ; BFILLDAT = Fill Date of current prescription and fill number
15 ; BWHERE (RX Action)
16 ; ARES = Resubmit for an auto-reversed claim was released while waiting
17 ; for the payer response
18 ; AREV = Auto-Reversal
19 ; BB = Back Billing
20 ; CRLB = CMOP Release & Rebill
21 ; CRLR = CMOP Release & Reverse (successful release)
22 ; CRLX = CMOP unsuccessful release & reverse
23 ; DC = Discontinue - only reverse un-released PAYABLE DC's, release date check
24 ; should be in calling routine.
25 ; DDED = Delete in edit
26 ; DE = Delete
27 ; ED = Edit
28 ; ERES = Resubmit from ECME user screen
29 ; EREV = Reversal from ECME user screen
30 ; HLD = Put prescription on Hold
31 ; OF = Original Fill
32 ; PC = Pull CMOPs
33 ; PE = Pull early from suspense
34 ; PL = Pull local from suspense
35 ; PP = PP from Patient Prescription Processing option
36 ; RF = Refill
37 ; RL = Release Rx NDC check - Rebill if billed NDC doesn't match release NDC
38 ; RN = Renew
39 ; RRL = Original claim rejected, submit another claim, no reversal
40 ; RS = Return-to-Stock
41 ; BILLNDC = Valid NDC# with format 5-4-2
42 ; REVREAS = Reversal Reason
43 ; DURREC = String of DUR info - Three "^" pieces
44 ; Professional Service Code
45 ; Reason for Service Code
46 ; Result of Service Code
47 ; BPOVRIEN = Pointer to BPS NCPDP OVERIDE file. This parameter will
48 ; only be passed if there are overrides entered by the
49 ; user via the Resubmit with Edits (RED) option in the
50 ; user screen.
51 ; BPSCLARF = Clarification Code (0-9,99), entered by pharmacist and passed
52 ; by Outpatient Pharmacy to ECME to put into the claim
53 ;
54 ;Output (RESPONSE^MESSAGE)
55 ; RESPONSE
56 ; 0 Submitted through ECME
57 ; 1 No submission through ECME
58 ; 2 IB not billable
59 ; 3 Claim was closed, not submitted (RTS/Deletes)
60 ; 4 Unable to queue claim
61 ; 5 Incorrect information supplied to ECME
62 ; 10 Reversal but no resubmit
63 ; MESSAGE = Message associated with the response (error/submitted)
64 ; ----------------- End of BPSNCPDP comments ----------------------
65 ;
66 ; Procedure STARRAY - Retrieve information for API call to IB and store in BPSARRY
67 ; Incoming Parameters
68 ; BRXIEN - Prescription IEN
69 ; BFILL - Fill Number
70 ; BWHERE - RX action
71 ; BPSARRY - Array that is built (passed by reference)
72 ; BPSITE - OUTPATIENT SITE file #59 ien
73STARRAY(BRXIEN,BFILL,BWHERE,BPSARRY,BPSITE) ;
74 N DRUGIEN,BPARR,BPSARR,QTY
75 D RXAPI^BPSUTIL1(BRXIEN,"6;7;8;31","BPARR","I")
76 I BFILL>0 D RXSUBF^BPSUTIL1(BRXIEN,52,52.1,BFILL,"1;1.1;17","BPARR","I")
77 S BPSARRY("DFN")=DFN
78 S BPSARRY("DAYS SUPPLY")=$S(BFILL=0:$G(BPARR(52,BRXIEN,8,"I")),1:$G(BPARR(52.1,BFILL,1.1,"I")))
79 S BPSARRY("IEN")=BRXIEN
80 S BPSARRY("FILL NUMBER")=BFILL
81 S BPSARRY("NDC")=BILLNDC
82 S (BPSARRY("DRUG"),DRUGIEN)=BPARR(52,BRXIEN,6,"I")
83 S BPSARRY("DEA")=$$DRUGDIE^BPSUTIL1(DRUGIEN,3)
84 S BPSARRY("COST")=$$DRUGDIE^BPSUTIL1(DRUGIEN,16)
85 S QTY=$S(BFILL=0:$G(BPARR(52,BRXIEN,7,"I")),1:$G(BPARR(52.1,BFILL,1,"I")))
86 S QTY=$$NCPDPQTY^PSSBPSUT(DRUGIEN,QTY)
87 S BPSARRY("QTY")=$P(QTY,U,1)
88 S BPSARRY("UNITS")=$P(QTY,U,2)
89 S BPSARRY("FILL DATE")=BFILLDAT
90 S BPSARRY("RELEASE DATE")=$P($S(BFILL=0:$G(BPARR(52,BRXIEN,31,"I")),1:$G(BPARR(52.1,BFILL,17,"I"))),".")
91 S BPSARRY("SC/EI OVR")=0
92 ;determine BPS PHARMACY
93 I $G(BPSITE)>0 S BPSARRY("EPHARM")=$$GETPHARM^BPSUTIL(BPSITE)
94 ;
95 ; Add user so that it is stored correctly in the IB Event Log
96 ; Note: Auto-Reversals (AREV) and CMOP/OPAI (CR*/PC/RL) use postmaster (.5)
97 I ",AREV,CRLB,CRLX,CRLR,PC,RL,"[(","_BWHERE_",") S BPSARRY("USER")=.5
98 E S BPSARRY("USER")=DUZ
99 Q
100 ;
101 ; Called by BPSNCPDP to display progress of claim
102STATUS(BRXIEN,BFILL,REBILL,REVONLY,BPSTART,BWHERE) ;
103 ; Initialization
104 N TRANSIEN,CERTUSER,BPSTO,END,IBSEQ,BPQ
105 N CLMSTAT,OCLMSTAT,RESUB,RESFL
106 S (CLMSTAT,OCLMSTAT)=0
107 ;
108 ; Set CERTUSER to true if this user is the certifier
109 S CERTUSER=^BPS(9002313.99,1,"CERTIFIER")=DUZ
110 ;
111 ; Build Transaction IEN
112 S TRANSIEN=BRXIEN_"."_$E($TR($J("",4-$L(BFILL))," ","0")_BFILL,1,4)_1
113 ;
114 ; Write Rebill and Status Messages
115 W !!,"Claim Status: "
116 I REBILL,$G(MOREDATA("REVERSE THEN RESUBMIT"))'=2 W !,"Reversing and Rebilling a previously submitted claim...",!,"Reversing..."
117 ;
118 ; Get the ECME Timeout and set the display timeout
119 S BPSTO=$$GET1^DIQ(9002313.99,"1,",3.01),END=$S(CERTUSER:50,$G(BPSTO)]"":BPSTO,1:5)
120 ;
121 ; For remaining time, loop through and display status
122 S (BPQ,RESFL)=0
123 F IBSEQ=1:1:END D Q:BPQ=1
124 . H 1
125 . ;
126 . ; Get status of resubmit, last update, and claim status
127 . S CLMSTAT=$$STATUS^BPSOSRX(BRXIEN,BFILL,1)
128 . S RESUB=$$GET1^DIQ(9002313.59,TRANSIEN_",",1.12,"I")
129 . ;
130 . ; Format status message
131 . S CLMSTAT=$P(CLMSTAT,"^",1)_$S($P(CLMSTAT,"^",1)["IN PROGRESS":"-"_$P(CLMSTAT,"^",3),1:"")
132 . ;
133 . ; If we are starting the resubmit, display message
134 . I REBILL,RESFL=0,RESUB=1,CLMSTAT["Resubmitting" W !,"Resubmitting..." S RESFL=1 Q
135 . I REBILL,RESFL=0,RESUB=2,CLMSTAT["IN PROGRESS" W !,"Resubmitting..." S RESFL=1
136 . ;
137 . ; If the status has changed, display the new message
138 . I OCLMSTAT'=CLMSTAT W !,CLMSTAT S OCLMSTAT=CLMSTAT
139 . ;
140 . ; If the status is not IN PROGRESS, then we are done
141 . I CLMSTAT'["IN PROGRESS" S BPQ=1
142 W !
143 Q
144 ;
145 ; Bulletin to the OPECC
146BULL(RXI,RXR,SITE,DFN,PATNAME) ;
147 N BTXT,XMSUB,XMY,XMTEXT,XMDUZ
148 N SSN,X,SITENM
149 I $G(SITE) D
150 . K ^TMP($J,"BPSARR")
151 . D PSS^PSO59(SITE,,"BPSARR")
152 . S SITENM=$G(^TMP($J,"BPSARR",SITE,.01))
153 I $G(DFN) D
154 . S X=$P($G(^DPT(DFN,0)),U,9)
155 . S SSN=$E(X,$L(X)-3,$L(X))
156 ;
157 ; Need to do in the background
158 ; Mailman calls CMOP which calls EN^BPSNCPDP.
159 ; If BPSNCPDP* (same process) then calls mailman, it gets confused.
160 N ZTIO,ZTRTN,ZTDTH,ZTSAVE,ZTDESC
161 N %,%H,%I,X
162 D NOW^%DTC
163 S ZTIO="",ZTDTH=%,ZTDESC="IN PROGRESS BULLETIN"
164 S ZTSAVE("RXR")="",ZTSAVE("RXI")=""
165 S ZTSAVE("SITENM")="",ZTSAVE("PATNAME")=""
166 S ZTSAVE("SSN")=""
167 S ZTRTN="BULL1^BPSNCPD1"
168 D ^%ZTLOAD
169 Q
170 ;
171BULL1 ;
172 S XMSUB="RX not processed for site "_$G(SITENM)
173 S BTXT(1)="Prescription "_$$RXAPI1^BPSUTIL1(RXI,.01,"E")_" and fill number "_+RXR_" could "
174 S BTXT(1)=BTXT(1)_"not be processed because the "
175 S BTXT(2)="previous request was in progress. There may have been a delay in processing "
176 S BTXT(3)="of the previous claim or the previous claim may be stranded."
177 S BTXT(4)=""
178 S BTXT(5)="For more information on this prescription's activity, please view the "
179 S BTXT(6)="ECME log within the View Prescription (VP) option on the Further Research (FR) "
180 S BTXT(7)="menu of the ECME user screen."
181 S BTXT(8)=""
182 S BTXT(9)="Patient Name: "_$G(PATNAME)
183 S BTXT(10)="Last four digits of SSN: "_$G(SSN)
184 S BTXT(11)=""
185 ;
186 S XMDUZ="BPS PACKAGE",XMTEXT="BTXT("
187 S XMY("G.BPS OPECC")=""
188 I $G(DUZ)'<1 S XMY(DUZ)=""
189 D ^XMD
190 Q
Note: See TracBrowser for help on using the repository browser.