| 1 | BPSSCRRS ;BHAM ISC/SS - ECME SCREEN RESUBMIT ;05-APR-05
 | 
|---|
| 2 |  ;;1.0;E CLAIMS MGMT ENGINE;**1,3,5**;JUN 2004;Build 45
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  Q
 | 
|---|
| 5 |  ;IA 4702
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 | RES ;
 | 
|---|
| 8 |  N BPRET,BPSARR59
 | 
|---|
| 9 |  I '$D(@(VALMAR)) Q
 | 
|---|
| 10 |  D FULL^VALM1
 | 
|---|
| 11 |  W !,"Enter the line numbers for the claim(s) to be resubmitted."
 | 
|---|
| 12 |  S BPRET=$$ASKLINES^BPSSCRU4("Select item(s)","C",.BPSARR59,VALMAR)
 | 
|---|
| 13 |  I BPRET="^" S VALMBCK="R" Q
 | 
|---|
| 14 |  ;go thru all selected claims and try to resubmit them separately
 | 
|---|
| 15 |  ;update the content of the screen and display it
 | 
|---|
| 16 |  ;only if at least one claim was submitted successfully
 | 
|---|
| 17 |  I $$RESUBMIT(.BPSARR59) D REDRAW^BPSSCRUD("Updating screen for resubmitted claims...")
 | 
|---|
| 18 |  E  S VALMBCK="R"
 | 
|---|
| 19 |  Q
 | 
|---|
| 20 |  ;
 | 
|---|
| 21 |  ;/**
 | 
|---|
| 22 |  ;go thru all selected claims and try to resubmit them separately
 | 
|---|
| 23 |  ;input:
 | 
|---|
| 24 |  ; RXI - array with ptrs to BPS TRANSACTION file (see ASKLINES^BPSSCRU4)
 | 
|---|
| 25 |  ;returns 
 | 
|---|
| 26 |  ; 0 - if no claims were resubmitted 
 | 
|---|
| 27 |  ; 1 - if at least one claim was resubmitted 
 | 
|---|
| 28 | RESUBMIT(RXI) ;*/
 | 
|---|
| 29 |  N BPRVRSED ;was successfully reversed
 | 
|---|
| 30 |  N BPRVNEED ;needs reversal
 | 
|---|
| 31 |  N BPRVWAIT ;cycles of waiting 
 | 
|---|
| 32 |  N BPRVRSNT ;reversal has been sent
 | 
|---|
| 33 |  N WHERE,DOSDATE,BILLNUM,RXIEN,RXR,BPDFN
 | 
|---|
| 34 |  N BP59
 | 
|---|
| 35 |  N UPDATFLG,BPCLTOT,BPCLTOTR
 | 
|---|
| 36 |  N BPQ
 | 
|---|
| 37 |  N BPSTATUS
 | 
|---|
| 38 |  N REVCOUNT S REVCOUNT=0
 | 
|---|
| 39 |  N BPIFANY S BPIFANY=0
 | 
|---|
| 40 |  S BPCLTOT=0 ;total for resubmitted
 | 
|---|
| 41 |  S BPCLTOTR=0 ;total for reversed, not resubmitted
 | 
|---|
| 42 |  S UPDATFLG=0
 | 
|---|
| 43 |  S BP59="",BPQ=""
 | 
|---|
| 44 |  F  S BP59=$O(RXI(BP59)) Q:BP59=""  D  Q:BPQ="^"
 | 
|---|
| 45 |  . I BPIFANY=0 W @IOF
 | 
|---|
| 46 |  . S BPIFANY=1,BPQ=""
 | 
|---|
| 47 |  . S BPDFN=+$P($G(^BPST(BP59,0)),U,6)
 | 
|---|
| 48 |  . W !,"You've chosen to RESUBMIT the following prescription for "_$E($$PATNAME^BPSSCRU2(BPDFN),1,13)
 | 
|---|
| 49 |  . W !,@VALMAR@(+$G(RXI(BP59)),0)
 | 
|---|
| 50 |  . S (BPRVNEED,BPRVRSED,BPRVWAIT,BPRVRSNT)=0
 | 
|---|
| 51 |  . S BPQ=$$YESNO("Are you sure?(Y/N)")
 | 
|---|
| 52 |  . I BPQ=-1 S BPQ="^" Q
 | 
|---|
| 53 |  . I BPQ'=1 Q
 | 
|---|
| 54 |  . S RXIEN=$P(BP59,".")
 | 
|---|
| 55 |  . S RXR=+$E($P(BP59,".",2),1,4)
 | 
|---|
| 56 |  . I BPRVNEED=1&(BPRVRSED'=1) Q  ;cannot be resubmitted
 | 
|---|
| 57 |  . I $$RXDEL^BPSOS(+RXIEN,RXR) W !!,">> Cannot Reverse or Resubmit ",!,@VALMAR@(+$G(RXI(BP59)),0),!," because it has been deleted in Pharmacy.",! Q
 | 
|---|
| 58 |  . S BPSTATUS=$P($$CLAIMST^BPSSCRU3(BP59),U)
 | 
|---|
| 59 |  . I BPSTATUS["E REVERSAL REJECTED" W !!,">> Cannot Resubmit ",!,@VALMAR@(+$G(RXI(BP59)),0),!," because the REVERSAL was rejected.",! Q
 | 
|---|
| 60 |  . I BPSTATUS["IN PROGRESS" W !!,">> Cannot Resubmit ",!,@VALMAR@(+$G(RXI(BP59)),0),!," because there is no response from the payer yet.",! Q
 | 
|---|
| 61 |  . I BPSTATUS["E REVERSAL STRANDED" W !!,">> Cannot Resubmit ",!,@VALMAR@(+$G(RXI(BP59)),0),!," because there is no response for reversal yet.",! Q
 | 
|---|
| 62 |  . S DOSDATE=$$DOSDATE(RXIEN,RXR)
 | 
|---|
| 63 |  . S BILLNUM=$$EN^BPSNCPDP(RXIEN,RXR,DOSDATE,"ERES","","ECME RESUBMIT")
 | 
|---|
| 64 |  . ;print return value message
 | 
|---|
| 65 |  . W !!
 | 
|---|
| 66 |  . W:+BILLNUM>0 $S(+BILLNUM=10:"Reversal but no Resubmit:",1:"Not Processed:"),!,"  "
 | 
|---|
| 67 |  . ;Change Return Message for SC/EI
 | 
|---|
| 68 |  . S:$P(BILLNUM,U,2)="NEEDS SC DETERMINATION" $P(BILLNUM,U,2)="NEEDS SC/EI DETERMINATION"
 | 
|---|
| 69 |  . W $P(BILLNUM,U,2)
 | 
|---|
| 70 |  . ;0 Prescription/Fill successfully submitted to ECME for claims processing
 | 
|---|
| 71 |  . ;1 ECME did not submit prescription/fill
 | 
|---|
| 72 |  . ;2 IB says prescription/fill is not ECME billable or the data returned from IB is not valid
 | 
|---|
| 73 |  . ;3 ECME closed the claim but did not submit it to the payer
 | 
|---|
| 74 |  . ;4 Unable to queue the ECME claim
 | 
|---|
| 75 |  . ;5 Invalid input
 | 
|---|
| 76 |  . ;10 Reversal but no resubmit
 | 
|---|
| 77 |  . I +BILLNUM=0 D 
 | 
|---|
| 78 |  . . D ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim resubmitted to 3rd party payer: ECME USER's SCREEN")
 | 
|---|
| 79 |  . . S UPDATFLG=1,BPCLTOT=BPCLTOT+1
 | 
|---|
| 80 |  . I +BILLNUM=10 D 
 | 
|---|
| 81 |  . . D ECMEACT^PSOBPSU1(+RXIEN,+RXR,"Claim reversed but not resubmitted: ECME USER's SCREEN")
 | 
|---|
| 82 |  . . S UPDATFLG=1,BPCLTOTR=BPCLTOTR+1
 | 
|---|
| 83 |  W:BPIFANY=0 !,"No eligible items selected."
 | 
|---|
| 84 |  W !,BPCLTOT," claim",$S(BPCLTOT'=1:"s have",1:" has")," been resubmitted.",!
 | 
|---|
| 85 |  W:BPCLTOTR>0 !,BPCLTOTR," claim",$S(BPCLTOTR'=1:"s have",1:" has")," been reversed but not resubmitted.",!
 | 
|---|
| 86 |  D PAUSE^VALM1
 | 
|---|
| 87 |  Q UPDATFLG
 | 
|---|
| 88 |  ;
 | 
|---|
| 89 |  ; Ask
 | 
|---|
| 90 |  ; Input:
 | 
|---|
| 91 |  ;  BPQSTR - question
 | 
|---|
| 92 |  ;  BPDFL - default answer
 | 
|---|
| 93 |  ; Output: 
 | 
|---|
| 94 |  ; 1 YES
 | 
|---|
| 95 |  ; 0 NO
 | 
|---|
| 96 |  ; -1 if cancelled
 | 
|---|
| 97 | YESNO(BPQSTR,BPDFL) ; Default - YES
 | 
|---|
| 98 |  N DIR,Y,DUOUT
 | 
|---|
| 99 |  S DIR(0)="Y"
 | 
|---|
| 100 |  S DIR("A")=BPQSTR
 | 
|---|
| 101 |  S:$L($G(BPDFL)) DIR("B")=BPDFL
 | 
|---|
| 102 |  D ^DIR
 | 
|---|
| 103 |  Q $S($G(DUOUT)!$G(DUOUT)!(Y="^"):-1,1:Y)
 | 
|---|
| 104 |  ;
 | 
|---|
| 105 |  ;Date of service
 | 
|---|
| 106 |  ;RXIEN - IEN in file #52
 | 
|---|
| 107 |  ;RXR - refill number
 | 
|---|
| 108 |  ;returns:
 | 
|---|
| 109 |  ; date of service
 | 
|---|
| 110 | DOSDATE(RXIEN,RXR) ;
 | 
|---|
| 111 |  N BPDOS,BPDT
 | 
|---|
| 112 |  ;try release date
 | 
|---|
| 113 |  S BPDOS=$$RXRLDT^PSOBPSUT(RXIEN,RXR)\1
 | 
|---|
| 114 |  Q:+BPDOS>0 BPDOS
 | 
|---|
| 115 |  ;try fill date
 | 
|---|
| 116 |  S BPDOS=$$RXFLDT^PSOBPSUT(RXIEN,RXR)\1
 | 
|---|
| 117 |  I '$G(DT) Q BPDOS
 | 
|---|
| 118 |  I BPDOS>0,BPDOS'>DT Q BPDOS
 | 
|---|
| 119 |  ;use current date (today)
 | 
|---|
| 120 |  Q DT\1
 | 
|---|
| 121 |  ;
 | 
|---|
| 122 |  ;To display the FILL date on the screen
 | 
|---|
| 123 |  ; use Date Of Service date , later on it might be changed
 | 
|---|
| 124 |  ;input:
 | 
|---|
| 125 |  ;RXIEN - IEN in file #52
 | 
|---|
| 126 |  ;RXR - refill number
 | 
|---|
| 127 |  ;returns:
 | 
|---|
| 128 |  ; date of service
 | 
|---|
| 129 |  ; or empty date if failure
 | 
|---|
| 130 | FILLDATE(RXIEN,RXR) ;
 | 
|---|
| 131 |  N DOSDT
 | 
|---|
| 132 |  S DOSDT=$$DOSDATE(RXIEN,RXR)
 | 
|---|
| 133 |  I $L(DOSDT)'=7 Q "  /  "
 | 
|---|
| 134 |  Q $E(DOSDT,4,5)_"/"_$E(DOSDT,6,7)
 | 
|---|
| 135 |  ;       
 | 
|---|