Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BPSOSHR

BPSOSHR.m

Go to the documentation of this file.
  1. BPSOSHR ;BHAM ISC/SD/lwj/DLF - Format conversion for reversals ;06/01/2004
  1. ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5**;JUN 2004;Build 45
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; This routine was originally used by IHS to reformat reversal claims
  1. ; into version 5.1 if the original billing request was version 3x.
  1. ; For that purpose, this routine is no longer needed. However,
  1. ; it also executes the special code fields so for that reason, it
  1. ; has not been removed. We also may need to do this if we change
  1. ; from version 5.1 to some other version, such as version 8, in the
  1. ; future.
  1. ;
  1. ; NOTE: There is a problem with special code if it relies on BPS array
  1. ; values, such as BPS("Site","NCPDP") since those variables will not
  1. ; be defined at this point. So, the only special code that will
  1. ; work are hard-coded values or executes of a procedure. If executing
  1. ; a procedure, it also needs to not rely on BPS array elements or needs
  1. ; to distinquish between billing requests and reversals.
  1. Q
  1. ;
  1. ; Input
  1. ; BPSFORM - Reversal payer sheet IEN
  1. ; CLAIMIEN - Original claim IEN
  1. ; POS - Multiple from original claim
  1. ;
  1. ; Input/Output
  1. ; TMP is the array originally created in BPSECA8. Since it is quite
  1. ; large, we are not passing it into here. It will be modified by
  1. ; this routine.
  1. ;
  1. REFORM(BPSFORM,CLAIMIEN,POS) ;
  1. ;
  1. ; Validate parameters
  1. I $G(BPSFORM)="" Q
  1. I $G(CLAIMIEN)="" Q
  1. I $G(POS)="" Q
  1. ;
  1. ; Initialize variables
  1. N FLDIEN,PMODE,ORDER,RECMIEN,FIELD,NODE
  1. ;
  1. ; First go through the header fields. The original IHS logic was only
  1. ; checking four specific fields. Of these, I removed:
  1. ; 109 (Transaction Count) - Always 1 for reversals and it does
  1. ; not make sense for this to be determined by special code.
  1. ; 201 (Service Provider ID) - The logic currently implemented
  1. ; relies on BPS array elements that are not defined here so this
  1. ; was getting set to NULL when it needed to be set. In addition
  1. ; I compared reversal and request (11/30/2006) and this value is
  1. ; always the same for both so reversals will get the right value
  1. ; from the request.
  1. ; 202 (Service Provider ID Qualifier) - It does not make sense
  1. ; to do this field if we are not doing field 201.
  1. ;
  1. ; So that leaves 110 (Software Vendor/Certification ID), which is needed
  1. ; by the WEBMD reversal test payer sheet.
  1. ;
  1. ; Kept looping structure in case other fields are added later
  1. ;
  1. S NODE=100,ORDER=0
  1. F S ORDER=$O(^BPSF(9002313.92,BPSFORM,NODE,"B",ORDER)) Q:'ORDER D
  1. . S RECMIEN=$O(^BPSF(9002313.92,BPSFORM,NODE,"B",ORDER,0))
  1. . I 'RECMIEN Q
  1. . S FLDIEN=$P($G(^BPSF(9002313.92,BPSFORM,NODE,RECMIEN,0)),U,2)
  1. . S FIELD=$P($G(^BPSF(9002313.91,FLDIEN,0)),U)
  1. . I FIELD'=110 Q
  1. . ;
  1. . ; Check to see if the format has special code. If not, quit
  1. . ; If we change versions (5x to ??), we made need to execute FORMAT
  1. . ; code no matter what, but for now, only do if there is special
  1. . ; code.
  1. . S PMODE=$P($G(^BPSF(9002313.92,BPSFORM,NODE,RECMIEN,0)),U,3)
  1. . I PMODE'="X" Q
  1. . ;
  1. . ; If special code, get the value, format it and store it in TMP
  1. . D XSPCCODE^BPSOSCF(BPSFORM,NODE,RECMIEN)
  1. . D FORMAT(NODE,FLDIEN)
  1. . S TMP(9002313.02,CLAIMIEN,FIELD,"I")=BPS("X")
  1. ;
  1. ; Now reformat the "detail" portion of the claim. For now, the only
  1. ; segment we are going to look at is 130, which is the claim segment
  1. ; If other reversal formats become available, and they require other
  1. ; segments - this section will have to change. Since the claim
  1. ; segment full of optional fields, we wil read through the format
  1. ; and take it a field at a time.
  1. S NODE=130,ORDER=0
  1. F S ORDER=$O(^BPSF(9002313.92,BPSFORM,NODE,"B",ORDER)) Q:'ORDER D
  1. . S RECMIEN=$O(^BPSF(9002313.92,BPSFORM,NODE,"B",ORDER,0))
  1. . I 'RECMIEN Q
  1. . S FLDIEN=$P($G(^BPSF(9002313.92,BPSFORM,NODE,RECMIEN,0)),U,2)
  1. . S FIELD=$P($G(^BPSF(9002313.91,FLDIEN,0)),U)
  1. . I FIELD=111 Q ; Never do Segment Indentifier
  1. . ;
  1. . ; Check to see if the format has special code. If not, quit
  1. . ; If we change versions (5x to ??), we made need to execute FORMAT
  1. . ; code no matter what, but for now, only do if there is special
  1. . ; code.
  1. . S PMODE=$P($G(^BPSF(9002313.92,BPSFORM,NODE,RECMIEN,0)),U,3)
  1. . I PMODE'="X" Q
  1. . ;
  1. . ; If special code, get the value, format it and store it in TMP
  1. . D XSPCCODE^BPSOSCF(BPSFORM,NODE,RECMIEN)
  1. . D FORMAT(NODE,FLDIEN)
  1. . S TMP(9002313.0201,POS_","_CLAIMIEN,FIELD,"I")=BPS("X")
  1. Q
  1. ;
  1. ; FORMAT will format the data based on the FORMAT code in BPS NCPDP
  1. ; FIELD DEFS
  1. FORMAT(NODE,FLDIEN) ;
  1. N INDEX,MCODE,QUAL
  1. ;
  1. ; Loop through format code and format the data
  1. S INDEX=0
  1. F S INDEX=$O(^BPSF(9002313.91,FLDIEN,25,INDEX)) Q:'+INDEX D
  1. . S MCODE=$G(^BPSF(9002313.91,FLDIEN,25,INDEX,0))
  1. . I MCODE="" Q
  1. . I $E(MCODE,1)=";" Q
  1. . X MCODE
  1. ;
  1. ; If node not equal to 100, append qualifier
  1. I NODE'=100 D
  1. . S QUAL=$P(^BPSF(9002313.91,FLDIEN,5),"^",1)
  1. . S BPS("X")=QUAL_BPS("X")
  1. Q