source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSOSCE.m@ 1005

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1BPSOSCE ;BHAM ISC/FCS/DRS/DLF - New entry in 9002313.02 ;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 ;----------------------------------------------------------------------
5 ;Creates an Electronic Claim Submission record
6 ;
7 ;Parameters: START - START Medication Number
8 ; END - END Medication Number
9 ; TOTAL - TOTAL Medications in Claim
10 ; - The BPS(*) array pointed to by START, END
11 ;
12 ; Note that the BPS array is shared by all of the BPSOSC* routines
13 ;----------------------------------------------------------------------
14 ; NEWCLAIM^BPSOSCE called from BPSOSCA from BPSOSQG from BPSOSQ2
15 ;
16 ; This routine is responsible for creating a new entry in the
17 ; claims file, and for calling the routines that then populate
18 ; that new entry.
19 ;
20 Q
21 ;
22NEWCLAIM(START,END,TOTAL) ;EP
23 ;
24 ;Manage local variables
25 N CLAIMID,DIC,DLAYGO,X,Y,COUNT,INDEX,DIK,DA,NODE0,ROU,ERROR,SEG
26 S ROU=$T(+0),START=+$G(START),END=+$G(END),TOTAL=+$G(TOTAL)
27 ;
28 ;Create new record in Claim Submission File (9002313.02)
29L L +^TMP($J,"BPSOSCE"):300 I '$T G L:$$IMPOSS^BPSOSUE("L","RTI","Single-threaded routine",,,$T(+0))
30 ;
31 ; Generate Claim ID
32 S CLAIMID=$$CLAIMID^BPSECX1($G(BPS("RX",START,"IEN59")))
33 I CLAIMID="" D Q ERROR
34 . S ERROR="320^VA Claim ID not created"
35 . D LOG(ROU_"-Failed to create Claim ID")
36 ;
37 ; Create claim record
38 S DLAYGO=9002313.02,DIC="^BPSC(",DIC(0)="LXZ",X=CLAIMID
39 D ^DIC S Y=+Y
40 L -^TMP($J,"BPSOSCE")
41 I Y<1 D Q ERROR
42 . S ERROR="321^Failed to create claim record"
43 . D LOG(ROU_"-Failed to create an entry in file 9002313.02")
44 ;
45 ; Update BPS and Log it
46 S BPS(9002313.02)=Y
47 ;
48 ; Needed for Turn-Around Stats - Do NOT delete/alter!!
49 D LOG(ROU_"-Created claim ID "_CLAIMID_" (IEN "_BPS(9002313.02)_")")
50 ;
51 ; Update the zero node of the claim
52 S NODE0=$G(^BPSC(BPS(9002313.02),0))
53 S $P(NODE0,U,2)=$G(BPS("NCPDP","IEN")) ; Electronic Payor (Payer Sheet)
54 S $P(NODE0,U,4)=2 ; Transmit Flag - 2 is 'Yes (Point of Sale)'
55 S $P(NODE0,U,6)=$$NOWFM^BPSOSU1() ; Created On
56 S ^BPSC(BPS(9002313.02),0)=NODE0
57 ;
58 ; Update Patient Name
59 S $P(^BPSC(BPS(9002313.02),1),U,1)=$G(BPS("Patient","Name"))
60 S $P(^BPSC(BPS(9002313.02),1),U,4)=$G(BPS("Insurer","IEN"))
61 ;
62 ; Only Billing Request call this routine so the transaction code
63 ; is always "B1"
64 S BPS("Transaction Code")="B1"
65 S BPS("Transaction Count")=TOTAL
66 ;
67 ; Process the 'non-multiple' segments (Header, Patient, Cardholder)
68 F SEG=100:10:120 D XLOOP^BPSOSCF(BPS("NCPDP","IEN"),SEG)
69 ;
70 ; Create the definition node for the multiple
71 S ^BPSC(BPS(9002313.02),400,0)="^9002313.0201PA^^"
72 ;
73 S COUNT=0
74 F INDEX=START:1:END D
75 . ;
76 . ;Create node zero of the medication multiple
77 . S COUNT=COUNT+1
78 . S NODE0=""
79 . S $P(NODE0,U,1)=INDEX
80 . S $P(NODE0,U,3)=INDEX
81 . S $P(NODE0,U,4)=$G(BPS("RX",INDEX,"Drug Name"))
82 . S $P(NODE0,U,5)=$G(BPS("RX",INDEX,"RX IEN"))
83 . S ^BPSC(BPS(9002313.02),400,INDEX,0)=NODE0
84 . ;
85 . ;
86 . I ^BPS(9002313.99,1,"CERTIFIER")=DUZ S INDEX=1 ;LJE
87 . S $P(^BPSC(BPS(9002313.02),400,INDEX,400),U,1)=BPS("RX",INDEX,"Date Filled")
88 . S BPS(9002313.0201)=INDEX ;07/28/96.
89 . ;
90 . ; Process multiples in the medication multiple
91 . F SEG=130:10:230 D XLOOP^BPSOSCF(BPS("NCPDP","IEN"),SEG,INDEX)
92 . ;
93 . ; Update the indices
94 . S ^BPSC(BPS(9002313.02),400,"B",INDEX,INDEX)=""
95 . S ^BPSC(BPS(9002313.02),400,"AC",INDEX,INDEX)=""
96 . S NODE0=$G(^BPSC(BPS(9002313.02),400,0))
97 . ;
98 . ; Update the definition node of the multiple
99 . S $P(NODE0,U,4)=COUNT
100 . S $P(NODE0,U,3)=$O(^BPSC(BPS(9002313.02),400,"A"),-1)
101 . S ^BPSC(BPS(9002313.02),400,0)=NODE0
102 . ;
103 ;
104 ; Cross-Reference Claim Submission Record
105 S DIK="^BPSC("
106 S DA=BPS(9002313.02)
107 D IX1^DIK
108 Q ""
109 ;
110 ; LOG - Write the message to all of transactions that are
111 ; being bundled into this 9002313.02 claim
112LOG(MSG) ;
113 N IEN59,I
114 F I=START:1:END D
115 . S IEN59=$G(BPS("RX",I,"IEN59"))
116 . I IEN59 D LOG^BPSOSL(IEN59,MSG)
117 Q
Note: See TracBrowser for help on using the repository browser.