- ABSPOSHF ;IHS/SD/lwj- Get/Format/Set value for DUR/PPS segment [ 09/04/2002 2:09 PM ]
- ;;1.0;PHARMACY POINT OF SALE;**3,23**;JUNE 21,2001;Build 38
- ;
- ; This routine is an addemdum to ABSPOSCF. Its purpose is to handle
- ; some of the repeating fields that now exist in NCPDP 5.1.
- ; The logic was put in here rather than ABSPOSCF to keep the original
- ; routine (ABSPOSCF) from growing too large and too cumbersome to
- ; maintain.
- ;
- ; At this point, the only repeating fields we handle in this routine
- ; are those contained in the DUR/PPS segment.
- ;
- ;IHS/SD/RLT - 06/27/07 - 10/18/07 - Patch 23
- ; DIAGNOSIS CODE in CLINICAL Segment.
- ;
- DURPPS(FORMAT,NODE,MEDN) ;EP called from ABSPOSCF
- ;---------------------------------------------------------------
- ;NCPDP 5.1 changes
- ; Processing of the 5.1 DUR/PPS segment is much different than the
- ; conventional segments of 3.2, simply because all of its fields
- ; are optional, and repeating. The repeating portion of this
- ; causes us to have yet another index we have to account for, and
- ; we must be able to tell which of the fields really needs to be
- ; populated. The population of this segment is based on those
- ; values found for the prescription or refill in the ABSP DUR/PPS
- ; file. The file's values are temporarily stored in the
- ; ABSP("RX",MEDN,DUR....) array for easy access and reference.
- ; (Special note - Overrides are not allowed on this multiple since
- ; they can simply update the DUR/PPS filed directly. For the same
- ; reason, "special" code is not accounted for either.
- ;---------------------------------------------------------------
- ;
- ; first order of business - check the ABSP("RX",MEDN,"DUR") array
- ; for values - if there aren't any, we don't need to write this
- ; segment
- ;
- N FIELD,ABSP51,RECCNT,DUR,FLD,OVERRIDE,FLAG,ORD,FLDIEN,FLDNUM
- S FLAG="FS"
- ;
- Q:'$D(ABSP("RX",MEDN,"DUR"))
- ;
- ;next we need to figure out which fields on this format are really
- ; needed, then we will loop through and populate them
- ;
- D GETFLDS(FORMAT,NODE,.FIELD)
- ;
- ; now lets get, format and set the field
- S ABSP51=1 ;needed in the set logic for dual 3.2/5.1 fields
- S (RECCNT,DUR)=0
- F S DUR=$O(ABSP("RX",MEDN,"DUR",DUR)) Q:DUR="" D
- . S RECCNT=RECCNT+1
- . S ORD=""
- . F S ORD=$O(FIELD(ORD)) Q:ORD="" D
- .. S FLDNUM=$P(FIELD(ORD),U,2)
- .. S FLDIEN=$P(FIELD(ORD),U)
- .. S ABSP("X")=$G(ABSP("RX",MEDN,"DUR",DUR,FLDNUM)) ;get
- .. D XFLDCODE^ABSPOSCF(FLDIEN,FLAG) ;format/set
- ;
- ; this sets the record count and last record on the subfile
- S ^ABSPC(ABSP(9002313.02),400,ABSP(9002313.0201),473.01,0)="^9002313.1001A^"_RECCNT_"^"_RECCNT
- ;
- Q
- ;
- DIAG(FORMAT,NODE,MEDN) ;EP called from ABSPOSCF
- ;DIAGNOSIS CODE in the CLINICAL Segment
- ;
- Q:'$D(ABSP("RX",MEDN,"DIAG")) ;quit if no data
- ;
- N FIELD,RECCNT,DIAG,FLD,OVERRIDE,FLAG,ORD,FLDIEN,FLDNUM
- S FLAG="FS"
- ;
- ; get list of fields
- D GETFLDS(FORMAT,NODE,.FIELD)
- ;
- ; set field 491 which is not repeating
- S ORD=0
- S FLDNUM=$P(FIELD(ORD),U,2)
- S FLDIEN=$P(FIELD(ORD),U)
- S ABSP("X")=$G(ABSP("RX",MEDN,"DIAG",ORD,FLDNUM)) ;get
- D XFLDCODE^ABSPOSCF(FLDIEN,FLAG) ;format/set
- ;
- ; get, format and set the field
- S (RECCNT,DIAG)=0
- F S DIAG=$O(ABSP("RX",MEDN,"DIAG",DIAG)) Q:'+DIAG D
- . S RECCNT=RECCNT+1
- . S ORD=0
- . F S ORD=$O(FIELD(ORD)) Q:'+ORD D
- .. S FLDNUM=$P(FIELD(ORD),U,2)
- .. S FLDIEN=$P(FIELD(ORD),U)
- .. S ABSP("X")=$G(ABSP("RX",MEDN,"DIAG",DIAG,FLDNUM)) ;get
- .. D XFLDCODE^ABSPOSCF(FLDIEN,FLAG) ;format/set
- ;
- ; set rec count and last rec on the subfile
- S ^ABSPC(ABSP(9002313.02),400,ABSP(9002313.0201),491.01,0)="^9002313.0701A^"_RECCNT_"^"_RECCNT
- ;
- Q
- ;
- GETFLDS(FORMAT,NODE,FIELD) ;EP NCPDP 5.1
- ;---------------------------------------------------------------
- ;This routine will get the list of repeating fields that must be
- ; be worked with separately
- ; (This was originally coded for the DUR/PPS segment - I'm not
- ; 100% sure how and if it will work for the other repeating
- ; fields that exist within a segment.)
- ;---------------------------------------------------------------
- ; Coming in:
- ; FORMAT = ABSPF(9002313.92 's format IEN
- ; NODE = which segment we are processing (i.e. 180 - DUR/PPS)
- ; .FIELD = array to store the values in
- ;
- ; Exitting:
- ; .FIELD array will look like:
- ; FIELD(ord)=int^ext
- ; Where: ext = external field number from ABSPF(9002313.91
- ; int = internal field number from ABSPF(9002313.91
- ; ord = the order of the field - used in creating clm
- ;---------------------------------------------------------------
- ;
- N ORDER,RECMIEN,MDATA,FLDIEN,FLDNUM,DUR
- ;
- S ORDER=0
- ;
- F D Q:'ORDER
- . ;
- . ; let's order through the format file for this node
- . ;
- . S ORDER=$O(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER)) Q:'ORDER
- . S RECMIEN=$O(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER,0))
- . I 'RECMIEN D IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"ORDER="_ORDER,2,$T(+0))
- . S MDATA=^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,0)
- . S FLDIEN=$P(MDATA,U,2)
- . I 'FLDIEN D IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"RECMIEN="_RECMIEN,3,$T(+0)) ; corrupt or erroneous format file
- . I '$D(^ABSPF(9002313.91,FLDIEN,0)) D IMPOSS^ABSPOSUE("DB,P","TI","FLDIEN="_FLDIEN,,"DURPPS",$T(+0)) ;incomplete field definition
- . ;
- . ;lets create a list of fields we need
- . S FLDNUM=$P($G(^ABSPF(9002313.91,FLDIEN,0)),U)
- . S:FLDNUM=491 FIELD(0)=FLDIEN_"^"_FLDNUM
- . S:FLDNUM'=111&(FLDNUM'=491) FIELD(ORDER)=FLDIEN_"^"_FLDNUM
- Q
- ABSPOSHF ;IHS/SD/lwj- Get/Format/Set value for DUR/PPS segment [ 09/04/2002 2:09 PM ]
- +1 ;;1.0;PHARMACY POINT OF SALE;**3,23**;JUNE 21,2001;Build 38
- +2 ;
- +3 ; This routine is an addemdum to ABSPOSCF. Its purpose is to handle
- +4 ; some of the repeating fields that now exist in NCPDP 5.1.
- +5 ; The logic was put in here rather than ABSPOSCF to keep the original
- +6 ; routine (ABSPOSCF) from growing too large and too cumbersome to
- +7 ; maintain.
- +8 ;
- +9 ; At this point, the only repeating fields we handle in this routine
- +10 ; are those contained in the DUR/PPS segment.
- +11 ;
- +12 ;IHS/SD/RLT - 06/27/07 - 10/18/07 - Patch 23
- +13 ; DIAGNOSIS CODE in CLINICAL Segment.
- +14 ;
- DURPPS(FORMAT,NODE,MEDN) ;EP called from ABSPOSCF
- +1 ;---------------------------------------------------------------
- +2 ;NCPDP 5.1 changes
- +3 ; Processing of the 5.1 DUR/PPS segment is much different than the
- +4 ; conventional segments of 3.2, simply because all of its fields
- +5 ; are optional, and repeating. The repeating portion of this
- +6 ; causes us to have yet another index we have to account for, and
- +7 ; we must be able to tell which of the fields really needs to be
- +8 ; populated. The population of this segment is based on those
- +9 ; values found for the prescription or refill in the ABSP DUR/PPS
- +10 ; file. The file's values are temporarily stored in the
- +11 ; ABSP("RX",MEDN,DUR....) array for easy access and reference.
- +12 ; (Special note - Overrides are not allowed on this multiple since
- +13 ; they can simply update the DUR/PPS filed directly. For the same
- +14 ; reason, "special" code is not accounted for either.
- +15 ;---------------------------------------------------------------
- +16 ;
- +17 ; first order of business - check the ABSP("RX",MEDN,"DUR") array
- +18 ; for values - if there aren't any, we don't need to write this
- +19 ; segment
- +20 ;
- +21 NEW FIELD,ABSP51,RECCNT,DUR,FLD,OVERRIDE,FLAG,ORD,FLDIEN,FLDNUM
- +22 SET FLAG="FS"
- +23 ;
- +24 IF '$DATA(ABSP("RX",MEDN,"DUR"))
- QUIT
- +25 ;
- +26 ;next we need to figure out which fields on this format are really
- +27 ; needed, then we will loop through and populate them
- +28 ;
- +29 DO GETFLDS(FORMAT,NODE,.FIELD)
- +30 ;
- +31 ; now lets get, format and set the field
- +32 ;needed in the set logic for dual 3.2/5.1 fields
- SET ABSP51=1
- +33 SET (RECCNT,DUR)=0
- +34 FOR
- SET DUR=$ORDER(ABSP("RX",MEDN,"DUR",DUR))
- IF DUR=""
- QUIT
- Begin DoDot:1
- +35 SET RECCNT=RECCNT+1
- +36 SET ORD=""
- +37 FOR
- SET ORD=$ORDER(FIELD(ORD))
- IF ORD=""
- QUIT
- Begin DoDot:2
- +38 SET FLDNUM=$PIECE(FIELD(ORD),U,2)
- +39 SET FLDIEN=$PIECE(FIELD(ORD),U)
- +40 ;get
- SET ABSP("X")=$GET(ABSP("RX",MEDN,"DUR",DUR,FLDNUM))
- +41 ;format/set
- DO XFLDCODE^ABSPOSCF(FLDIEN,FLAG)
- End DoDot:2
- End DoDot:1
- +42 ;
- +43 ; this sets the record count and last record on the subfile
- +44 SET ^ABSPC(ABSP(9002313.02),400,ABSP(9002313.0201),473.01,0)="^9002313.1001A^"_RECCNT_"^"_RECCNT
- +45 ;
- +46 QUIT
- +47 ;
- DIAG(FORMAT,NODE,MEDN) ;EP called from ABSPOSCF
- +1 ;DIAGNOSIS CODE in the CLINICAL Segment
- +2 ;
- +3 ;quit if no data
- IF '$DATA(ABSP("RX",MEDN,"DIAG"))
- QUIT
- +4 ;
- +5 NEW FIELD,RECCNT,DIAG,FLD,OVERRIDE,FLAG,ORD,FLDIEN,FLDNUM
- +6 SET FLAG="FS"
- +7 ;
- +8 ; get list of fields
- +9 DO GETFLDS(FORMAT,NODE,.FIELD)
- +10 ;
- +11 ; set field 491 which is not repeating
- +12 SET ORD=0
- +13 SET FLDNUM=$PIECE(FIELD(ORD),U,2)
- +14 SET FLDIEN=$PIECE(FIELD(ORD),U)
- +15 ;get
- SET ABSP("X")=$GET(ABSP("RX",MEDN,"DIAG",ORD,FLDNUM))
- +16 ;format/set
- DO XFLDCODE^ABSPOSCF(FLDIEN,FLAG)
- +17 ;
- +18 ; get, format and set the field
- +19 SET (RECCNT,DIAG)=0
- +20 FOR
- SET DIAG=$ORDER(ABSP("RX",MEDN,"DIAG",DIAG))
- IF '+DIAG
- QUIT
- Begin DoDot:1
- +21 SET RECCNT=RECCNT+1
- +22 SET ORD=0
- +23 FOR
- SET ORD=$ORDER(FIELD(ORD))
- IF '+ORD
- QUIT
- Begin DoDot:2
- +24 SET FLDNUM=$PIECE(FIELD(ORD),U,2)
- +25 SET FLDIEN=$PIECE(FIELD(ORD),U)
- +26 ;get
- SET ABSP("X")=$GET(ABSP("RX",MEDN,"DIAG",DIAG,FLDNUM))
- +27 ;format/set
- DO XFLDCODE^ABSPOSCF(FLDIEN,FLAG)
- End DoDot:2
- End DoDot:1
- +28 ;
- +29 ; set rec count and last rec on the subfile
- +30 SET ^ABSPC(ABSP(9002313.02),400,ABSP(9002313.0201),491.01,0)="^9002313.0701A^"_RECCNT_"^"_RECCNT
- +31 ;
- +32 QUIT
- +33 ;
- GETFLDS(FORMAT,NODE,FIELD) ;EP NCPDP 5.1
- +1 ;---------------------------------------------------------------
- +2 ;This routine will get the list of repeating fields that must be
- +3 ; be worked with separately
- +4 ; (This was originally coded for the DUR/PPS segment - I'm not
- +5 ; 100% sure how and if it will work for the other repeating
- +6 ; fields that exist within a segment.)
- +7 ;---------------------------------------------------------------
- +8 ; Coming in:
- +9 ; FORMAT = ABSPF(9002313.92 's format IEN
- +10 ; NODE = which segment we are processing (i.e. 180 - DUR/PPS)
- +11 ; .FIELD = array to store the values in
- +12 ;
- +13 ; Exitting:
- +14 ; .FIELD array will look like:
- +15 ; FIELD(ord)=int^ext
- +16 ; Where: ext = external field number from ABSPF(9002313.91
- +17 ; int = internal field number from ABSPF(9002313.91
- +18 ; ord = the order of the field - used in creating clm
- +19 ;---------------------------------------------------------------
- +20 ;
- +21 NEW ORDER,RECMIEN,MDATA,FLDIEN,FLDNUM,DUR
- +22 ;
- +23 SET ORDER=0
- +24 ;
- +25 FOR
- Begin DoDot:1
- +26 ;
- +27 ; let's order through the format file for this node
- +28 ;
- +29 SET ORDER=$ORDER(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER))
- IF 'ORDER
- QUIT
- +30 SET RECMIEN=$ORDER(^ABSPF(9002313.92,FORMAT,NODE,"B",ORDER,0))
- +31 IF 'RECMIEN
- DO IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"ORDER="_ORDER,2,$TEXT(+0))
- +32 SET MDATA=^ABSPF(9002313.92,FORMAT,NODE,RECMIEN,0)
- +33 SET FLDIEN=$PIECE(MDATA,U,2)
- +34 ; corrupt or erroneous format file
- IF 'FLDIEN
- DO IMPOSS^ABSPOSUE("DB","TI","NODE="_NODE,"RECMIEN="_RECMIEN,3,$TEXT(+0))
- +35 ;incomplete field definition
- IF '$DATA(^ABSPF(9002313.91,FLDIEN,0))
- DO IMPOSS^ABSPOSUE("DB,P","TI","FLDIEN="_FLDIEN,,"DURPPS",$TEXT(+0))
- +36 ;
- +37 ;lets create a list of fields we need
- +38 SET FLDNUM=$PIECE($GET(^ABSPF(9002313.91,FLDIEN,0)),U)
- +39 IF FLDNUM=491
- SET FIELD(0)=FLDIEN_"^"_FLDNUM
- +40 IF FLDNUM'=111&(FLDNUM'=491)
- SET FIELD(ORDER)=FLDIEN_"^"_FLDNUM
- End DoDot:1
- IF 'ORDER
- QUIT
- +41 QUIT