PSOREJU3 ;BIRM/LJE - BPS (ECME) - Clinical Rejects Utilities (3) ;04/25/08
;;7.0;OUTPATIENT PHARMACY;**287**;DEC 1997;Build 77
;References to 9002313.99 supported by IA 4305
;
Q
;
TRICCHK(RX,RFL,RESP,FROM,RVTX) ;check to see if Rx is non-billable or in an "In Progress" state on ECME
; Input: (r) RX - Rx IEN (#52)
; (r) RFL - REFILL
; (o) RESP - Response from $$EN^BPSNCPDP api
; TRICCHK assumes that the calling routine has validated that the fill is Tricare.
;
; - \Need to be mindful of foreground and background processing.
;
N ETOUT,ESTAT
S:'$D(FROM) FROM="" S ESTAT="",ESTAT=$P(RESP,"^",4),NFROM=0 I FROM="PL"!(FROM="PC") S NFROM=1
Q:ESTAT["PAYABLE"!(ESTAT["REJECTED")
I ESTAT["IN PROGRESS",FROM="RRL"!($G(RVTX)="RX RELEASE-NDC CHANGE") D Q
. I 'NFROM D
. . W !!,"TRICARE Prescription "_$$GET1^DIQ(52,RX,".01")_" cannot be released until ECME 'IN PROGRESS'"
. . W !,"status is resolved payable.",!!
;
I $D(RESP) D Q
. I +RESP=6 W:'NFROM&('$G(CMOP)) !!,"Inactive ECME Tricare",!! D Q
. . S ACT="Inactive ECME Tricare" D RXACT^PSOBPSU2(RX,RFL,ACT,"M",DUZ)
. I +RESP=2!(+RESP=3) N PSONBILL S PSONBILL=1 D TRIC2 Q
. I +RESP=4!(ESTAT["IN PROGRESS") N PSONPROG S PSONPROG=1 D TRIC2 Q
Q
;
TRIC2 ;
N ACTION,REJCOD,REJ,DIR,DIRUT,REA,DA,PSCAN,PSOTRIC,ZZZ
S PSOTRIC=1,REJ=9999999999
I $G(CMOP)&($G(PSONPROG)) D TACT Q
Q:$G(CMOP)
I 'NFROM D DISPLAY(RX,REJ)
I 'NFROM&($G(PSONPROG)) D D SUSP Q
. W !!,"This prescription will be suspended. After the third party claim is resolved,"
. W !,"it may be printed or pulled early from suspense.",!
. R !!,"Press <RETURN> to continue...",ZZZ:60,!
I NFROM&($G(PSONPROG)) D TACT Q
Q:NFROM
TRIC3 ;
D MSG W " It must be discontinued."
R !!,"Press <RETURN> to continue...",ZZZ:60
I FROM="PL"!(FROM="PC") D SUSP Q
S ACTION="D" S ACTION=$$DC^PSOREJU1(RX,ACTION)
I ACTION="Q" G TRIC2
Q
;
MSG ;
W !!,"This is a non-billable Tricare prescription. It cannot be filled or sent",!
W "to the reject worklist."
Q
SUSP ;Suspense Rx due to IN PROGRESS status in ECME
N DA,ACT,RX0,SD,RXS,PSOWFLG,DIK,RXN,XFLAG,RXP,DD,DO,X,Y,DIC,VALMSG,COMM,LFD,DFLG,RXCMOP
N PSOQFLAG,PSORXZD,PSOQFLAG,PSOKSPPL,PSOZXPPL,PSOZXPI,RXLTOP
S DA=RX D SUS^PSORXL1
TACT ;
S ACT="TRICARE-Rx placed on Suspense due to"_$S($G(PSONPROG):" ECME IN PROGRESS status",$G(PSONBILL):"the Rx being Non-billable",1:"")
I '$G(DUZ) N DUZ S DUZ=.5
D RXACT^PSOBPSU2(RX,RFL,ACT,"M",DUZ)
Q
;
DISPLAY(RX,REJ,KEY) ; - Displays REJECT information
; Input: (r) RX - Rx IEN (#52)
; (r) REJ - REJECT ID (IEN)
; (o) KEY - Display "Press any KEY to continue..." (1-YES/0-NO) (Default: 0)
;
Q:$G(NFROM)
I '$G(RX)!'$G(REJ) Q
I '$D(^PSRX(RX,"REJ",REJ))&('$G(PSONBILL))&('$G(PSONPROG)) Q
;
N DATA,RFL,LINE,%
S RFL=+$$GET1^DIQ(52.25,REJ_","_RX,5)
I '$G(PSONBILL)&('$G(PSONPROG)) D GET^PSOREJU2(RX,RFL,.DATA,REJ) I '$D(DATA(REJ)) Q
;
D HDR
S $P(LINE,"-",74)="" W !?3,LINE
W !?3,$$DVINFO^PSOREJU2(RX,RFL)
W !?3,$$PTINFO^PSOREJU2(RX)
W !?3,"Rx/Drug : ",$$GET1^DIQ(52,RX,.01),"/",RFL," - ",$E($$GET1^DIQ(52,RX,6),1,20),?54
W:'$G(PSONBILL)&('$G(PSONPROG)) "ECME#: ",$E(RX+10000000,2,8)
D TYPE G DISP2:$G(PSONBILL)!($G(PSONPROG))
I $G(DATA(REJ,"PAYER MESSAGE"))'="" W !?3,"Payer Message: " D PRT^PSOREJU2("PAYER MESSAGE",18,58)
I $G(DATA(REJ,"DUR TEXT"))'="" W !?3,"DUR Text : ",DATA(REJ,"DUR TEXT")
W !?3,"Insurance : ",DATA(REJ,"INSURANCE NAME"),?50,"Contact: ",DATA(REJ,"PLAN CONTACT")
W !?3,"Group Name : ",DATA(REJ,"GROUP NAME"),?45,"Group Number: ",DATA(REJ,"GROUP NUMBER")
I $G(DATA(REJ,"CARDHOLDER ID"))'="" W !?3,"Cardholder ID: ",DATA(REJ,"CARDHOLDER ID")
I DATA(REJ,"PLAN PREVIOUS FILL DATE")'="" D
. W !?3,"Last Fill Dt.: ",DATA(REJ,"PLAN PREVIOUS FILL DATE")
. W:DATA(REJ,"PLAN PREVIOUS FILL DATE")'="" " (from payer)"
DISP2 ;
W !?3,LINE,$C(7) I $G(KEY) W !?3,"Press <RETURN> to continue..." R %:DTIME W !
Q
;
TYPE ;
I $G(PSONBILL)!($G(PSONPROG)) D Q
. D NOW^%DTC S Y=% D DD^%DT
. W !?3,"Date/Time: "_$$FMTE^XLFDT(Y)
. W !?3,"Reason : ",$S($G(PSONBILL):"Drug not billable.",$G(PSONPROG):"ECME Status is in an 'IN PROGRESS' state and cannot be filled",1:"")
;
I $G(DATA(REJ,"REASON"))'="" W !?3,"Reason : " D PRT^PSOREJU2("REASON",18,58)
N RTXT,OCODE,OTXT,I
S (OTXT,RTXT,OCODE)="",RTXT=$S(DATA(REJ,"CODE")=79:"REFILL TOO SOON",CODE=88:"DUR REJECT",1:$$EXP^PSOREJP1(CODE))_" ("_DATA(REJ,"CODE")_")"
F I=1:1 S OCODE=$P(DATA(REJ,"OTHER REJECTS"),",",I) Q:OCODE="" D
. S OTXT=OTXT_", "_$S(OCODE=79:"REFILL TOO SOON",OCODE=88:"DUR REJECT",1:$$EXP^PSOREJP1(OCODE))_" ("_OCODE_")"
S RTXT=RTXT_OTXT_". Received on "_$$FMTE^XLFDT($G(DATA(REJ,"DATE/TIME")))_"."
S OTXT=""
W !?3,"Reject(s): " D WRAP(RTXT,14)
Q
;
WRAP(PSOTXT,INDENT) ;
N I,K,PSOWRAP,PSOMARG
S PSOWRAP=1,PSOMARG=$S('$G(PSORM):80,$D(IOM):IOM,1:80)-(INDENT+5)
W1 S:$L(PSOTXT)<PSOMARG PSOWRAP(PSOWRAP)=PSOTXT I $L(PSOTXT)'<PSOMARG F I=PSOMARG:-1:0 I $E(PSOTXT,I)?1P S PSOWRAP(PSOWRAP)=$E(PSOTXT,1,I),PSOTXT=$E(PSOTXT,I+1,999),PSOWRAP=PSOWRAP+1 G W1
F K=1:1:PSOWRAP W ?INDENT,PSOWRAP(K),!
Q
;
HDR ;
I $G(PSONBILL) W !!?24,"*** TRICARE - NON-BILLABLE ***" Q
I $G(PSONPROG) W !!?18,"*** TRICARE - 'IN PROGRESS' ECME status ***" Q
I $G(PSOTRIC) W !!?12,"*** TRICARE - "
E W !!?16
W "REJECT RECEIVED FROM THIRD PARTY PAYER ***" Q
Q
;
SUBMIT(RXIEN,RFCNT,PSOTRIC) ;called from PSOCAN2 (routine size exceeded)
N SUBMITE S SUBMITE=$$SUBMIT^PSOBPSUT(RXIEN)
I SUBMITE D
. N ACTION
. D ECMESND^PSOBPSU1(RXIEN,,,$S($O(^PSRX(RXIEN,1,0)):"RF",1:"OF"))
. I $$FIND^PSOREJUT(RXIEN) S ACTION=$$HDLG^PSOREJU1(RXIEN,,"79,88","OF","IOQ","Q")
I 'SUBMITE&(PSOTRIC) D
. I $$STATUS^PSOBPSUT(RXIEN,RFCNT'["PAYABLE") D TRICCHK(RXIEN,RFCNT)
Q
;
TRISTA(RX,RFL,RESP,FROM,RVTX) ;called from suspense
N ETOUT,ESTAT,TRESP,TSTAT,PSOTRIC
S:'$D(RESP) RESP=""
S (ESTAT,PSOTRIC)="",PSOTRIC=$$TRIC^PSOREJP1(RX,RFL,PSOTRIC)
Q:'PSOTRIC 0
S TRESP=RESP,ESTAT=$P(TRESP,"^",4)
;
I '$D(RESP)!($P(RESP,"^",1)="")!($G(RESP)="") D
. S TSTAT=$$STATUS^PSOBPSUT(RX,RFL) S TRESP=$S(TSTAT["IN PROGRESS":4,TSTAT["NOT BILLABLE":2,1:0)
. S $P(TRESP,"^",4)=TSTAT
;
Q:ESTAT["PAYABLE"!(ESTAT["REJECTED") 0
;
I +TRESP=2!(+TRESP=3) Q 1
I +TRESP=4!(ESTAT["IN PROGRESS") Q 1
Q 0
;
PSOREJU3 ;BIRM/LJE - BPS (ECME) - Clinical Rejects Utilities (3) ;04/25/08
+1 ;;7.0;OUTPATIENT PHARMACY;**287**;DEC 1997;Build 77
+2 ;References to 9002313.99 supported by IA 4305
+3 ;
+4 QUIT
+5 ;
TRICCHK(RX,RFL,RESP,FROM,RVTX) ;check to see if Rx is non-billable or in an "In Progress" state on ECME
+1 ; Input: (r) RX - Rx IEN (#52)
+2 ; (r) RFL - REFILL
+3 ; (o) RESP - Response from $$EN^BPSNCPDP api
+4 ; TRICCHK assumes that the calling routine has validated that the fill is Tricare.
+5 ;
+6 ; - \Need to be mindful of foreground and background processing.
+7 ;
+8 NEW ETOUT,ESTAT
+9 IF '$DATA(FROM)
SET FROM=""
SET ESTAT=""
SET ESTAT=$PIECE(RESP,"^",4)
SET NFROM=0
IF FROM="PL"!(FROM="PC")
SET NFROM=1
+10 IF ESTAT["PAYABLE"!(ESTAT["REJECTED")
QUIT
+11 IF ESTAT["IN PROGRESS"
IF FROM="RRL"!($GET(RVTX)="RX RELEASE-NDC CHANGE")
Begin DoDot:1
+12 IF 'NFROM
Begin DoDot:2
+13 WRITE !!,"TRICARE Prescription "_$$GET1^DIQ(52,RX,".01")_" cannot be released until ECME 'IN PROGRESS'"
+14 WRITE !,"status is resolved payable.",!!
End DoDot:2
End DoDot:1
QUIT
+15 ;
+16 IF $DATA(RESP)
Begin DoDot:1
+17 IF +RESP=6
IF 'NFROM&('$GET(CMOP))
WRITE !!,"Inactive ECME Tricare",!!
Begin DoDot:2
+18 SET ACT="Inactive ECME Tricare"
DO RXACT^PSOBPSU2(RX,RFL,ACT,"M",DUZ)
End DoDot:2
QUIT
+19 IF +RESP=2!(+RESP=3)
NEW PSONBILL
SET PSONBILL=1
DO TRIC2
QUIT
+20 IF +RESP=4!(ESTAT["IN PROGRESS")
NEW PSONPROG
SET PSONPROG=1
DO TRIC2
QUIT
End DoDot:1
QUIT
+21 QUIT
+22 ;
TRIC2 ;
+1 NEW ACTION,REJCOD,REJ,DIR,DIRUT,REA,DA,PSCAN,PSOTRIC,ZZZ
+2 SET PSOTRIC=1
SET REJ=9999999999
+3 IF $GET(CMOP)&($GET(PSONPROG))
DO TACT
QUIT
+4 IF $GET(CMOP)
QUIT
+5 IF 'NFROM
DO DISPLAY(RX,REJ)
+6 IF 'NFROM&($GET(PSONPROG))
Begin DoDot:1
+7 WRITE !!,"This prescription will be suspended. After the third party claim is resolved,"
+8 WRITE !,"it may be printed or pulled early from suspense.",!
+9 READ !!,"Press <RETURN> to continue...",ZZZ:60,!
End DoDot:1
DO SUSP
QUIT
+10 IF NFROM&($GET(PSONPROG))
DO TACT
QUIT
+11 IF NFROM
QUIT
TRIC3 ;
+1 DO MSG
WRITE " It must be discontinued."
+2 READ !!,"Press <RETURN> to continue...",ZZZ:60
+3 IF FROM="PL"!(FROM="PC")
DO SUSP
QUIT
+4 SET ACTION="D"
SET ACTION=$$DC^PSOREJU1(RX,ACTION)
+5 IF ACTION="Q"
GOTO TRIC2
+6 QUIT
+7 ;
MSG ;
+1 WRITE !!,"This is a non-billable Tricare prescription. It cannot be filled or sent",!
+2 WRITE "to the reject worklist."
+3 QUIT
SUSP ;Suspense Rx due to IN PROGRESS status in ECME
+1 NEW DA,ACT,RX0,SD,RXS,PSOWFLG,DIK,RXN,XFLAG,RXP,DD,DO,X,Y,DIC,VALMSG,COMM,LFD,DFLG,RXCMOP
+2 NEW PSOQFLAG,PSORXZD,PSOQFLAG,PSOKSPPL,PSOZXPPL,PSOZXPI,RXLTOP
+3 SET DA=RX
DO SUS^PSORXL1
TACT ;
+1 SET ACT="TRICARE-Rx placed on Suspense due to"_$SELECT($GET(PSONPROG):" ECME IN PROGRESS status",$GET(PSONBILL):"the Rx being Non-billable",1:"")
+2 IF '$GET(DUZ)
NEW DUZ
SET DUZ=.5
+3 DO RXACT^PSOBPSU2(RX,RFL,ACT,"M",DUZ)
+4 QUIT
+5 ;
DISPLAY(RX,REJ,KEY) ; - Displays REJECT information
+1 ; Input: (r) RX - Rx IEN (#52)
+2 ; (r) REJ - REJECT ID (IEN)
+3 ; (o) KEY - Display "Press any KEY to continue..." (1-YES/0-NO) (Default: 0)
+4 ;
+5 IF $GET(NFROM)
QUIT
+6 IF '$GET(RX)!'$GET(REJ)
QUIT
+7 IF '$DATA(^PSRX(RX,"REJ",REJ))&('$GET(PSONBILL))&('$GET(PSONPROG))
QUIT
+8 ;
+9 NEW DATA,RFL,LINE,%
+10 SET RFL=+$$GET1^DIQ(52.25,REJ_","_RX,5)
+11 IF '$GET(PSONBILL)&('$GET(PSONPROG))
DO GET^PSOREJU2(RX,RFL,.DATA,REJ)
IF '$DATA(DATA(REJ))
QUIT
+12 ;
+13 DO HDR
+14 SET $PIECE(LINE,"-",74)=""
WRITE !?3,LINE
+15 WRITE !?3,$$DVINFO^PSOREJU2(RX,RFL)
+16 WRITE !?3,$$PTINFO^PSOREJU2(RX)
+17 WRITE !?3,"Rx/Drug : ",$$GET1^DIQ(52,RX,.01),"/",RFL," - ",$EXTRACT($$GET1^DIQ(52,RX,6),1,20),?54
+18 IF '$GET(PSONBILL)&('$GET(PSONPROG))
WRITE "ECME#: ",$EXTRACT(RX+10000000,2,8)
+19 DO TYPE
IF $GET(PSONBILL)!($GET(PSONPROG))
GOTO DISP2
+20 IF $GET(DATA(REJ,"PAYER MESSAGE"))'=""
WRITE !?3,"Payer Message: "
DO PRT^PSOREJU2("PAYER MESSAGE",18,58)
+21 IF $GET(DATA(REJ,"DUR TEXT"))'=""
WRITE !?3,"DUR Text : ",DATA(REJ,"DUR TEXT")
+22 WRITE !?3,"Insurance : ",DATA(REJ,"INSURANCE NAME"),?50,"Contact: ",DATA(REJ,"PLAN CONTACT")
+23 WRITE !?3,"Group Name : ",DATA(REJ,"GROUP NAME"),?45,"Group Number: ",DATA(REJ,"GROUP NUMBER")
+24 IF $GET(DATA(REJ,"CARDHOLDER ID"))'=""
WRITE !?3,"Cardholder ID: ",DATA(REJ,"CARDHOLDER ID")
+25 IF DATA(REJ,"PLAN PREVIOUS FILL DATE")'=""
Begin DoDot:1
+26 WRITE !?3,"Last Fill Dt.: ",DATA(REJ,"PLAN PREVIOUS FILL DATE")
+27 IF DATA(REJ,"PLAN PREVIOUS FILL DATE")'=""
WRITE " (from payer)"
End DoDot:1
DISP2 ;
+1 WRITE !?3,LINE,$CHAR(7)
IF $GET(KEY)
WRITE !?3,"Press <RETURN> to continue..."
READ %:DTIME
WRITE !
+2 QUIT
+3 ;
TYPE ;
+1 IF $GET(PSONBILL)!($GET(PSONPROG))
Begin DoDot:1
+2 DO NOW^%DTC
SET Y=%
DO DD^%DT
+3 WRITE !?3,"Date/Time: "_$$FMTE^XLFDT(Y)
+4 WRITE !?3,"Reason : ",$SELECT($GET(PSONBILL):"Drug not billable.",$GET(PSONPROG):"ECME Status is in an 'IN PROGRESS' state and cannot be filled",1:"")
End DoDot:1
QUIT
+5 ;
+6 IF $GET(DATA(REJ,"REASON"))'=""
WRITE !?3,"Reason : "
DO PRT^PSOREJU2("REASON",18,58)
+7 NEW RTXT,OCODE,OTXT,I
+8 SET (OTXT,RTXT,OCODE)=""
SET RTXT=$SELECT(DATA(REJ,"CODE")=79:"REFILL TOO SOON",CODE=88:"DUR REJECT",1:$$EXP^PSOREJP1(CODE))_" ("_DATA(REJ,"CODE")_")"
+9 FOR I=1:1
SET OCODE=$PIECE(DATA(REJ,"OTHER REJECTS"),",",I)
IF OCODE=""
QUIT
Begin DoDot:1
+10 SET OTXT=OTXT_", "_$SELECT(OCODE=79:"REFILL TOO SOON",OCODE=88:"DUR REJECT",1:$$EXP^PSOREJP1(OCODE))_" ("_OCODE_")"
End DoDot:1
+11 SET RTXT=RTXT_OTXT_". Received on "_$$FMTE^XLFDT($GET(DATA(REJ,"DATE/TIME")))_"."
+12 SET OTXT=""
+13 WRITE !?3,"Reject(s): "
DO WRAP(RTXT,14)
+14 QUIT
+15 ;
WRAP(PSOTXT,INDENT) ;
+1 NEW I,K,PSOWRAP,PSOMARG
+2 SET PSOWRAP=1
SET PSOMARG=$SELECT('$GET(PSORM):80,$DATA(IOM):IOM,1:80)-(INDENT+5)
W1 IF $LENGTH(PSOTXT)<PSOMARG
SET PSOWRAP(PSOWRAP)=PSOTXT
IF $LENGTH(PSOTXT)'<PSOMARG
FOR I=PSOMARG:-1:0
IF $EXTRACT(PSOTXT,I)?1P
SET PSOWRAP(PSOWRAP)=$EXTRACT(PSOTXT,1,I)
SET PSOTXT=$EXTRACT(PSOTXT,I+1,999)
SET PSOWRAP=PSOWRAP+1
GOTO W1
+1 FOR K=1:1:PSOWRAP
WRITE ?INDENT,PSOWRAP(K),!
+2 QUIT
+3 ;
HDR ;
+1 IF $GET(PSONBILL)
WRITE !!?24,"*** TRICARE - NON-BILLABLE ***"
QUIT
+2 IF $GET(PSONPROG)
WRITE !!?18,"*** TRICARE - 'IN PROGRESS' ECME status ***"
QUIT
+3 IF $GET(PSOTRIC)
WRITE !!?12,"*** TRICARE - "
+4 IF '$TEST
WRITE !!?16
+5 WRITE "REJECT RECEIVED FROM THIRD PARTY PAYER ***"
QUIT
+6 QUIT
+7 ;
SUBMIT(RXIEN,RFCNT,PSOTRIC) ;called from PSOCAN2 (routine size exceeded)
+1 NEW SUBMITE
SET SUBMITE=$$SUBMIT^PSOBPSUT(RXIEN)
+2 IF SUBMITE
Begin DoDot:1
+3 NEW ACTION
+4 DO ECMESND^PSOBPSU1(RXIEN,,,$SELECT($ORDER(^PSRX(RXIEN,1,0)):"RF",1:"OF"))
+5 IF $$FIND^PSOREJUT(RXIEN)
SET ACTION=$$HDLG^PSOREJU1(RXIEN,,"79,88","OF","IOQ","Q")
End DoDot:1
+6 IF 'SUBMITE&(PSOTRIC)
Begin DoDot:1
+7 IF $$STATUS^PSOBPSUT(RXIEN,RFCNT'["PAYABLE")
DO TRICCHK(RXIEN,RFCNT)
End DoDot:1
+8 QUIT
+9 ;
TRISTA(RX,RFL,RESP,FROM,RVTX) ;called from suspense
+1 NEW ETOUT,ESTAT,TRESP,TSTAT,PSOTRIC
+2 IF '$DATA(RESP)
SET RESP=""
+3 SET (ESTAT,PSOTRIC)=""
SET PSOTRIC=$$TRIC^PSOREJP1(RX,RFL,PSOTRIC)
+4 IF 'PSOTRIC
QUIT 0
+5 SET TRESP=RESP
SET ESTAT=$PIECE(TRESP,"^",4)
+6 ;
+7 IF '$DATA(RESP)!($PIECE(RESP,"^",1)="")!($GET(RESP)="")
Begin DoDot:1
+8 SET TSTAT=$$STATUS^PSOBPSUT(RX,RFL)
SET TRESP=$SELECT(TSTAT["IN PROGRESS":4,TSTAT["NOT BILLABLE":2,1:0)
+9 SET $PIECE(TRESP,"^",4)=TSTAT
End DoDot:1
+10 ;
+11 IF ESTAT["PAYABLE"!(ESTAT["REJECTED")
QUIT 0
+12 ;
+13 IF +TRESP=2!(+TRESP=3)
QUIT 1
+14 IF +TRESP=4!(ESTAT["IN PROGRESS")
QUIT 1
+15 QUIT 0
+16 ;