source: FOIAVistA/tag/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSOSHF.m@ 628

Last change on this file since 628 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1BPSOSHF ;BHAM ISC/SD/lwj/DLF - Get/Format/Set value for DUR/PPS segment ;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 ; This routine is an addendum to BPSOSCF. Its purpose is to handle
6 ; some of the repeating fields that now exist in NCPDP 5.1.
7 ; The logic was put in here rather than BPSOSCF to keep the original
8 ; routine (BPSOSCF) from growing too large and too cumbersome to
9 ; maintain.
10 ;
11 ; At this point, the only repeating fields we handle in this routine
12 ; are those contained in the DUR/PPS segment.
13 ;
14DURPPS(FORMAT,NODE,MEDN) ;EP called from BPSOSCF
15 ;---------------------------------------------------------------
16 ;NCPDP 5.1 changes
17 ; Processing of the 5.1 DUR/PPS segment is much different than the
18 ; conventional segments of 3.2, simply because all of its fields
19 ; are optional, and repeating. The repeating portion of this
20 ; causes us to have yet another index we have to account for, and
21 ; we must be able to tell which of the fields really needs to be
22 ; populated. The population of this segment is based on those
23 ; values found for the prescription or refill in the BPS DUR/PPS
24 ; file. The file's values are temporarily stored in the
25 ; BPS("RX",MEDN,DUR....) array for easy access and reference.
26 ; (Special note - Overrides are not allowed on this multiple since
27 ; they can simply update the DUR/PPS filed directly. For the same
28 ; reason, "special" code is not accounted for either.
29 ;---------------------------------------------------------------
30 ;
31 ; first order of business - check the BPS("RX",MEDN,"DUR") array
32 ; for values - if there aren't any, we don't need to write this
33 ; segment
34 ;
35 N FIELD,RECCNT,DUR,FLD,OVERRIDE,FLAG,ORD,FLDIEN,FLDNUM,FLDNUMB,FOUND
36 S FLAG="FS"
37 I ^BPS(9002313.99,1,"CERTIFIER")=DUZ S FLAG="GFS"
38 ;
39 Q:'$D(BPS("RX",MEDN,"DUR"))
40 ;
41 ;next we need to figure out which fields on this format are really
42 ; needed, then we will loop through and populate them
43 ;
44 D GETFLDS(FORMAT,NODE,.FIELD)
45 ;
46 ; now lets get, format and set the field
47 S (ORD,RECCNT,DUR)=0
48 S RECCNT=RECCNT+1
49 F S DUR=$O(BPS("RX",MEDN,"DUR",DUR)) Q:DUR="" D
50 . S FLDNUM="" F S FLDNUM=$O(BPS("RX",MEDN,"DUR",DUR,FLDNUM)) Q:FLDNUM="" D
51 .. S ORD="",FOUND=0
52 .. F S ORD=$O(FIELD(ORD)) Q:ORD="" D Q:FOUND
53 ... S FLDNUMB="",FLDNUMB=$P(FIELD(ORD),U,2) Q:FLDNUMB'=FLDNUM
54 ... S FLDIEN="",FLDIEN=$P(FIELD(ORD),U)
55 ... S BPS("X")=BPS("RX",MEDN,"DUR",DUR,FLDNUM)
56 ... S FOUND=1
57 ... D XFLDCODE^BPSOSCF(NODE,FLDIEN,FLAG) ;format/set
58 ;
59 ; this sets the record count and last record on the subfile
60 S ^BPSC(BPS(9002313.02),400,BPS(9002313.0201),473.01,0)="^9002313.1001A^"_RECCNT_"^"_RECCNT
61 ;
62 Q
63GETFLDS(FORMAT,NODE,FIELD) ;EP NCPDP 5.1
64 ;---------------------------------------------------------------
65 ;This routine will get the list of repeating fields that must be
66 ; be worked with separately
67 ; (This was originally coded for the DUR/PPS segment - I'm not
68 ; 100% sure how and if it will work for the other repeating
69 ; fields that exist within a segment.)
70 ;---------------------------------------------------------------
71 ; Coming in:
72 ; FORMAT = BPSF(9002313.92 's format IEN
73 ; NODE = which segment we are processing (i.e. 180 - DUR/PPS)
74 ; .FIELD = array to store the values in
75 ;
76 ; Exitting:
77 ; .FIELD array will look like:
78 ; FIELD(ord)=int^ext
79 ; Where: ext = external field number from BPSF(9002313.91
80 ; int = internal field number from BPSF(9002313.91
81 ; ord = the order of the field - used in creating clm
82 ;---------------------------------------------------------------
83 ;
84 N ORDER,RECMIEN,MDATA,FLDIEN,FLDNUM,DUR
85 ;
86 S ORDER=0
87 ;
88 F D Q:'ORDER
89 . ;
90 . ; let's order through the format file for this node
91 . ;
92 . S ORDER=$O(^BPSF(9002313.92,FORMAT,NODE,"B",ORDER)) Q:'ORDER
93 . S RECMIEN=$O(^BPSF(9002313.92,FORMAT,NODE,"B",ORDER,0))
94 . I 'RECMIEN D IMPOSS^BPSOSUE("DB","TI","NODE="_NODE,"ORDER="_ORDER,2,$T(+0))
95 . S MDATA=^BPSF(9002313.92,FORMAT,NODE,RECMIEN,0)
96 . S FLDIEN=$P(MDATA,U,2)
97 . I 'FLDIEN D IMPOSS^BPSOSUE("DB","TI","NODE="_NODE,"RECMIEN="_RECMIEN,3,$T(+0)) ; corrupt or erroneous format file
98 . I '$D(^BPSF(9002313.91,FLDIEN,0)) D IMPOSS^BPSOSUE("DB,P","TI","FLDIEN="_FLDIEN,,"DURPPS",$T(+0)) ;incomplete field definition
99 . ;
100 . ;lets create a list of fields we need
101 . S FLDNUM=$P($G(^BPSF(9002313.91,FLDIEN,0)),U)
102 . S:FLDNUM'=111 FIELD(ORDER)=FLDIEN_"^"_FLDNUM
103 ;
104 ;
105 Q
Note: See TracBrowser for help on using the repository browser.