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

BPSRES1.m

Go to the documentation of this file.
  1. BPSRES1 ;AITC/MRD - ECME SCREEN RESUBMIT W/EDITS ;10/23/17
  1. ;;1.0;E CLAIMS MGMT ENGINE;**23,24,32**;JUN 2004;Build 15
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ADDLFLDS(BPS02,BPS59,BPSADDLFLDS,BPSDOS) ; Add fields to a claim.
  1. ; This function allows the user to add to claim fields not on payer
  1. ; sheet. It is used by the RED/Resubmit with Edits Action on the
  1. ; ECME User Screen and by the PRO Option (Process Secondary/TRICARE
  1. ; Rx to ECME).
  1. ; Input: BPS02 = Pointer to BPS CLAIMS
  1. ; BPS59 = Pointer to BSP TRANSACTION
  1. ; BPSDOS = Date of Service; if passed in, then display
  1. ; when listing fields to be added to claim
  1. ; This function will return:
  1. ; 1 - If user entered additional fields.
  1. ; 0 - If user added no fields.
  1. ; -1 - If user exited out via "^".
  1. ; This function will also set up the array BPSADDFLDS if the user
  1. ; chooses to add any fields to the claim.
  1. ; BPSADDLFLDS(Field IEN) = Value to Send
  1. ;
  1. N BPS,BPSFIELD,BPSGETCODE,BPSPAYER,BPSQ,BPSSEGMENT
  1. N DIC,MEDN,TRANLIST,X,Y
  1. ;
  1. ; Prompt user whether to enter additional fields. If user enters
  1. ; "No", display the Date of Service, if it exists, then Quit with 0.
  1. ; If user enters "^", Quit with -1.
  1. ;
  1. W !
  1. S BPSQ=$$YESNO^BPSSCRRS("Submit NCPDP Field Not on Payer Sheet (Y/N)","N")
  1. I BPSQ=0,$G(BPSDOS)'="" W !!,"Fields entered to transmit:",!,?4,"Date of Service: ",$$FMTE^XLFDT(BPSDOS,"5D")
  1. I BPSQ'=1 Q BPSQ
  1. ;
  1. ; Kill array that will contain list of fields to be added.
  1. ;
  1. K BPSADDLFLDS
  1. ;
  1. ; Build an array listing the fields already on the payer sheet and an
  1. ; array listing all segments on the payer sheet. Include all segments,
  1. ; though some may be excluded later.
  1. ;
  1. D ARRAYS(BPS02,.BPSPAYER,.BPSSEGMENT)
  1. I 'BPSPAYER Q 0
  1. ;
  1. ; Build BPS array. While each field in the file BPS NCPDP FIELD DEFS
  1. ; has Get Code (executable M code) for pulling the data value, the way
  1. ; this has been implemented is that first the subroutine $$BPS^BPSOSCB
  1. ; pulls many fields of data, building the BPS array, and then the
  1. ; Get Code for each field puts into BPS("X") a value from the BPS
  1. ; array. Because the system needs to display to the user the value
  1. ; that would be sent with a field being added to the claim, we need to
  1. ; build the entire BPS array, which will be used by the Get Code for
  1. ; any fields selected by the user. TRANLIST is an array listing all
  1. ; BPS Transactions in this batch of claims. However, the VA does not
  1. ; ever batch claims, so there is always only one transaction in that
  1. ; list. BPS(9002313.0201) must be set to 1. It should never return a
  1. ; value other than 0, but if it does, Quit.
  1. ;
  1. S TRANLIST(BPS59)=""
  1. S BPS(9002313.0201)=1
  1. S X=$$BPS^BPSOSCB
  1. I X W !,$P(X,U,2),".",!,"Fields may not be added at this time." Q 0
  1. ;
  1. ; Display help text.
  1. ;
  1. W !!,"Enter a valid NCPDP Field name or number. Enter '??' for"
  1. W !,"a list of possible choices. Fields already on the payer sheet"
  1. W !,"are excluded from the list of possible choices. Also excluded"
  1. W !,"are any fields that do not have logic to pull data from VistA"
  1. W !,"(i.e. fields that will always be <blank>)."
  1. ;
  1. A1 ; Prompt user for an NCPDP field to add to the claim.
  1. ;
  1. K DIC
  1. ;
  1. S DIC=9002313.91
  1. S DIC(0)="AEMQ"
  1. S DIC("A")="NCPDP Field Name or Number: "
  1. S DIC("S")="I $$CHECK^BPSRES1(Y,.BPSPAYER,.BPSSEGMENT)"
  1. S DIC("T")=""
  1. ;
  1. W !
  1. D ^DIC
  1. ;
  1. ; When the user just hits <return>, skip down to A2.
  1. ;
  1. I X="" G A2
  1. ;
  1. I Y=-1 Q -1
  1. S BPSFIELD=+Y
  1. ;
  1. ; Disallow a field already added.
  1. ;
  1. I $D(BPSADDLFLDS(BPSFIELD)) W !,?4,"This field has already been added to the claim.",*7 G A1
  1. ;
  1. ; Display to the user the value to be sent with this field.
  1. ;
  1. S BPS("X")=""
  1. S MEDN=1 ; Required for some GET codes.
  1. S BPSGETCODE=0
  1. F S BPSGETCODE=$O(^BPSF(9002313.91,BPSFIELD,10,BPSGETCODE)) Q:'BPSGETCODE X $G(^BPSF(9002313.91,BPSFIELD,10,BPSGETCODE,0))
  1. W !,?4,"Value to transmit: ",BPS("X")
  1. S BPSQ=$$YESNO^BPSSCRRS("Transmit with claim (Y/N)","Y")
  1. I BPSQ=0 G A1
  1. I BPSQ=-1 K BPSADDLFLDS Q -1
  1. ;
  1. ; Add selected field to array (Y=internal field #).
  1. ;
  1. S BPSADDLFLDS(BPSFIELD)=BPS("X")
  1. ;
  1. G A1
  1. ;
  1. A2 ; User is done selecting fields to add.
  1. ;
  1. ; If user added no fields, Quit with 0.
  1. ;
  1. I '$D(BPSADDLFLDS),'$G(BPSDOS) Q 0
  1. ;
  1. ; Display to the user the list of fields being added to the claim.
  1. ;
  1. W !!,"Fields entered to transmit:"
  1. I $G(BPSDOS)'="" W !,?4,"Date of Service: ",$$FMTE^XLFDT(BPSDOS,"5D")
  1. S BPSFIELD=""
  1. F S BPSFIELD=$O(BPSADDLFLDS(BPSFIELD)) Q:'BPSFIELD D
  1. . W !,?4,$$GET1^DIQ(9002313.91,BPSFIELD,.01),"-"
  1. . W $$GET1^DIQ(9002313.91,BPSFIELD,.06)," "
  1. . W $$GET1^DIQ(9002313.91,BPSFIELD,.03),": "
  1. . W BPSADDLFLDS(BPSFIELD)
  1. . Q
  1. ;
  1. Q 1
  1. ;
  1. ARRAYS(BPS02,BPSPAYER,BPSSEGMENT) ; Build BPSPAYER array and BPSSEGMENT array.
  1. ;
  1. ; Build an array listing the fields already on the payer sheet and
  1. ; an array listing all segments on the payer sheet. Include all
  1. ; segments, though some may be excluded later.
  1. ;
  1. N BPSFIELD,BPSORDER
  1. ;
  1. S BPSPAYER=$$GET1^DIQ(9002313.02,BPS02,.02,"I") ; Payer Sheet.
  1. I 'BPSPAYER Q
  1. F BPSSEGMENT=100:10:300 D
  1. . I '$D(^BPSF(9002313.92,BPSPAYER,BPSSEGMENT)) Q
  1. . S BPSSEGMENT(BPSSEGMENT)=""
  1. . S BPSORDER=0
  1. . F S BPSORDER=$O(^BPSF(9002313.92,BPSPAYER,BPSSEGMENT,BPSORDER)) Q:'BPSORDER D
  1. . . S BPSFIELD=$P($G(^BPSF(9002313.92,BPSPAYER,BPSSEGMENT,BPSORDER,0)),"^",2) ; Field IEN
  1. . . I BPSFIELD'="" S BPSPAYER(BPSFIELD)=""
  1. . . Q
  1. . Q
  1. ;
  1. Q
  1. ;
  1. CHECK(BPSY,BPSPAYER,BPSSEGMENT) ; Screen for BPS NCPDP FIELD DEFS lookup. See ADDLFLDS above.
  1. ; This function is called for a given entry in the file BPS
  1. ; NCPDP FIELD DEFS, where +Y will be the IEN. If this function
  1. ; returns a 1, then this entry is a valid choice. If this
  1. ; function returns a 0, then this entry will not be displayed to
  1. ; the user when listing possible choices and this entry will not
  1. ; be a valid choice for the user.
  1. ;
  1. ; Disallow if already on the payer sheet.
  1. ;
  1. I $D(BPSPAYER(+BPSY)) Q 0
  1. ;
  1. ; Disallow if this field is not on a request segment or if this
  1. ; field is on a segment not on the payer sheet.
  1. ;
  1. S BPSSEGMENT=$P($G(^BPSF(9002313.91,+BPSY,5)),"^",4) ; Request Segment.
  1. S BPSSEGMENT=$P($G(^BPSF(9002313.9,+BPSSEGMENT,0)),"^",2)
  1. I BPSSEGMENT="" Q 0
  1. I '$D(BPSSEGMENT(BPSSEGMENT)) Q 0
  1. ;
  1. ; There are many segments the VA does not send, even if that
  1. ; segment is on a payer sheet. Disallow any fields that are
  1. ; on one of those segments.
  1. ;
  1. I ",140,170,200,210,220,230,240,250,260,270,280,290,300,"[(","_BPSSEGMENT_",") Q 0
  1. ;
  1. ; Disallow if Get Code is simply Setting BPS("X") to "".
  1. ;
  1. I $G(^BPSF(9002313.91,+BPSY,10,1,0))["S BPS(""X"")=""""" Q 0
  1. ;
  1. Q 1
  1. ;
  1. SAVE(BPSACTION,BPS59,BPSADDLFLDS,BPSOVRIEN) ; Save into BPS NCPDP OVERRIDES (#9002313.511)
  1. ;
  1. ; If the user chooses to add any fields to the claim, each field
  1. ; will be listed as BPSADDLFLDS(Field IEN).
  1. ;
  1. ; Input: BPSACTION = Action selected by user (e.g. RED, PRO)
  1. ; BPS59 = Pointer to BPS TRANSACTIONS
  1. ; BPSADDLFLDS = Passed by reference, array listing the
  1. ; NCPDP fields to be added to the claim.
  1. ; BPSADDLFLDS(NCPDP Field) = ""
  1. ; BPSOVRIEN = Passed by reference, ien of entry in the
  1. ; file BPS NCPDP OVERRIDE
  1. ;
  1. N BPSFDA,BPSFIELD,BPSMSG,BPSCNT,BPSFIELD
  1. ;
  1. S BPSFDA(9002313.511,"+1,",.01)=BPS59
  1. D NOW^%DTC
  1. S BPSFDA(9002313.511,"+1,",.02)=%
  1. ;
  1. ; Store the fields for which the user was prompted.
  1. ;
  1. S BPSCNT=1
  1. I BPSACTION="RED" D
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",303,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+2,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+2,+1,",.02)=BPPSNCD
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",306,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+3,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+3,+1,",.02)=BPRELCD
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",462,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+4,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+4,+1,",.02)=BPPREAUT
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",461,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+5,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+5,+1,",.02)=BPPRETYP
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",420,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+6,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+6,+1,",.02)=BPCLCD1_"~"_$G(BPCLCD2)_"~"_$G(BPCLCD3)
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",384,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+7,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+7,+1,",.02)=BPPTRES
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",147,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+8,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+8,+1,",.02)=BPPHSRV
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",357,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+9,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+9,+1,",.02)=BPDLYRS
  1. . S BPSFIELD=$O(^BPSF(9002313.91,"B",305,"")) I BPSFIELD]"" S BPSFDA(9002313.5111,"+10,+1,",.01)=BPSFIELD,BPSFDA(9002313.5111,"+10,+1,",.02)=BPGENDER
  1. . S BPSCNT=10
  1. . Q
  1. ;
  1. ; Store additional NCPDP fields which the user chose to add to the
  1. ; the resubmitted claim.
  1. ;
  1. S BPSFIELD=0
  1. F S BPSFIELD=$O(BPSADDLFLDS(BPSFIELD)) Q:'BPSFIELD D
  1. . S BPSCNT=BPSCNT+1
  1. . S BPSFDA(9002313.5112,"+"_BPSCNT_",+1,",.01)=BPSFIELD ; Field#
  1. . S BPSFDA(9002313.5112,"+"_BPSCNT_",+1,",.02)=$$GET1^DIQ(9002313.91,BPSFIELD,2,"I") ; Segment#
  1. . Q
  1. ;
  1. D UPDATE^DIE("","BPSFDA","BPSOVRIEN","BPSMSG")
  1. ;
  1. I $D(BPSMSG("DIERR")) D Q -1
  1. . W !!,"Could not save override information into BPS NCPDP OVERRIDE file.",!
  1. . N DIR
  1. . S DIR(0)="E"
  1. . S DIR("A")="Press Return to continue."
  1. . D ^DIR
  1. . Q
  1. ;
  1. Q 1
  1. ;