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

ABSPOS6B.m

Go to the documentation of this file.
  1. ABSPOS6B ; IHS/FCS/DRS - user display screen, cont ;
  1. ;;1.0;PHARMACY POINT OF SALE;*29,31*;JUN 21, 2001;Build 38
  1. Q
  1. INFO(PAT,RXI) ;EP - from ABSPOS6H
  1. ; IF '$G(RXI), then this is a patient summary line:
  1. ; INFO("%")=% completion
  1. ; INFO("COUNT")=how many for this patient
  1. ; INFO("PATIEN")=ien into patient file
  1. ; INFO("STAT",status)=count
  1. ; INFO("RES")="- - - 3 prescriptions - - -", for example, if inc.
  1. ; but if complete,
  1. ; INFO("RES")="* FINISHED * 1 rejected * 2 payable", for example
  1. ;
  1. ; If we are going to do prescription detail, then the RESULTS
  1. ; area for this patient will simply say how many prescriptions
  1. ; and each individual prescription has its own result detail
  1. ; But if this is a patient summary with no prescription detail,
  1. ; then pull all the results together into:
  1. ; INFO("RES",result code^text)=count
  1. ;
  1. ; IF $G(RXI), then this is a prescription detail line
  1. ; INFO("DRUG")=drug name
  1. ; INFO("RES")=final result or processing status, and presc. #
  1. ; (depending on whether status is 100% or not)
  1. ; INFO("PATIEN") as above
  1. ; INFO("STAT")=processing status (text)
  1. ; INFO("DUR")=Brief DUR response info (just conflict and message)
  1. ;
  1. INFO1 IF $G(RXI) D Q
  1. .N REVERSAL S REVERSAL=$G(^ABSPT(RXI,4)) ; is it a rev'l?
  1. .I 'REVERSAL S REVERSAL=$P(REVERSAL,U,3) ; if not elect, maybe paper
  1. .N INSURER S INSURER=$P(^ABSPT(RXI,1),U,6)
  1. .S INSURER=$S(INSURER:$P(^AUTNINS(INSURER,0),U),1:"")
  1. .; eligibility etc. for SELF PAY reworded during final result
  1. .; in ABSPOSQ1 and then again for real in billing
  1. .N IEN52 S IEN52=$P(^ABSPT(RXI,1),U,11)
  1. .N X
  1. .I IEN52 D
  1. . . N RX0 S RX0=$G(^PSRX(IEN52,0)),X=$P(RX0,U,6)
  1. . . I X]"" S X=$P($G(^PSDRUG(X,0)),U)
  1. . . I X="" S X="(can't find in DRUG file?)"
  1. . . I RXI[".",$E(RXI,$L(RXI))=2 S X="Postage-"_X
  1. .E D
  1. . . N CPT S CPT=$P(RXI,".",2),CPT=+$E(CPT,1,$L(CPT)-1)
  1. . . ; $GET because of timing problem?
  1. . . S X=$P($G(^ABSCPT(9002300,CPT,0)),U,2) ; short desc
  1. .S INFO("DRUG")=X,INFO("STAT")=""
  1. .;I ONEPAT S INFO("STAT")=$$ONEPAT^ABSPOS6C_" " ; dates
  1. .;I REVERSAL S INFO("STAT")=INFO("STAT")_"*REVERSAL* "
  1. .S INFO("RES")=INFO("STAT")
  1. .N STAT S STAT=$P(@DISP@(PAT,RXI),U,2)
  1. .I STAT=100 D
  1. . . S INFO("DUR")=$$DURBRIEF^ABSPOS6G(RXI)
  1. . . I INFO("DUR")]"" S INFO("RES")=INFO("RES")_"DUR! "
  1. .E D
  1. . . S INFO("DUR")=""
  1. . . S INFO("STAT")=INFO("STAT")_$$STATI^ABSPOSU(STAT)
  1. .I STAT=31!(STAT=51) D ; retry due to comms problem or ins. asleep
  1. . . N X S X=$G(^ABSPT(RXI,8)) Q:X=""
  1. . . N Y S Y=$P(X,U) X ^DD("DD") S Y=$P(Y,"@",2),X=$P(X,U,2)
  1. . . S INFO("STAT")=INFO("STAT")_" after "_Y
  1. . . Q:'X S X=$P(^ABSP(9002313.55,X,0),U)
  1. . . I STAT=51 S INFO("STAT")=INFO("STAT")_" to dial out to "_X
  1. .I INSURER]"" D
  1. . . N X S X=INFO("STAT")_" "
  1. . . S X=X_$S(STAT>99:"by",STAT>69:"from",STAT>49:"to",1:"for")
  1. . . S INFO("STAT")=X_" "_INSURER
  1. .I STAT=100 D
  1. . . N X S X=$$RESULT(RXI)
  1. . . S INFO("RES")=$S(X]"":X,1:"(Missing result?)")
  1. . E S INFO("RES")=INFO("STAT")
  1. .S INFO("RES")=INFO("RES")_" ("_$S(RXI[".":RXI,1:"Prescription `"_RXI)_")"
  1. .S INFO("PATIEN")=$P(^ABSPT(RXI,0),U,6)
  1. .I 'INFO("PATIEN") S INFO("PATIEN")=$P($G(^PSRX(IEN52,0)),U,2)
  1. .I INFO("DUR")]"" S INFO("RES")=INFO("RES")_" DUR:"_INFO("DUR")
  1. .I REVERSAL S INFO("RES")="*REVERSAL* "_INFO("RES")
  1. .I ONEPAT S INFO("RES")=$$ONEPAT^ABSPOS6C_" "_INFO("RES")
  1. .I STAT<99,$G(^ABSPT(RXI,3)) D
  1. ..S INFO("RES")="*CANCELLATION REQUESTED* "_INFO("RES")
  1. ;
  1. ; Else we're doing a patient record:
  1. ;
  1. INFO6 N X S X=@DISP@(PAT)
  1. N N,K S (N,INFO("COUNT"))=$P(X,U,4)
  1. S INFO("%")=$P(X,U,2)/$P(X,U,4)+.5\1
  1. I INFO("%")=100 D
  1. .S INFO("RES")="** FINISHED ** "
  1. .I $P(X,U,5)+$P(X,U,6)+$P(X,U,7)+$P(X,U,8)+$P(X,U,9)'=N D INFO8 ;reCALC
  1. .S K=$P(X,U,5) I K D S INFO("RES")=INFO("RES")_K_" rejected *"
  1. ..S K=$S(N=1:"",K=N:$S(K=2:"BOTH",1:"ALL"),1:K)
  1. .S K=$P(X,U,6) I K D S INFO("RES")=INFO("RES")_K_" not electronic *"
  1. ..S K=$S(N=1:"",K=N:$S(K=2:"BOTH",1:"ALL"),1:K)
  1. .S K=$P(X,U,7) I K D S INFO("RES")=INFO("RES")_K_" payable *"
  1. ..S K=$S(N=1:"",K=N:$S(K=2:"BOTH",1:"ALL"),1:K)
  1. .S K=$P(X,U,8) I K D S INFO("RES")=INFO("RES")_K_" rejected reversal *"
  1. ..S K=$S(N=1:"",K=N:$S(K=2:"BOTH",1:"ALL"),1:K)
  1. .S K=$P(X,U,9) I K D S INFO("RES")=INFO("RES")_K_" accepted reversal *"
  1. ..S K=$S(N=1:"",K=N:$S(K=2:"BOTH",1:"ALL"),1:K)
  1. .S INFO("RES")=INFO("RES")_"*"
  1. E D
  1. .N N,S ;,C
  1. .S N=$P(X,U,4),S=$S(N=1:"",1:"s") ;,C=$P(X,U,5)+$P(X,U,6)+$P(X,U,7)
  1. .S INFO("RES")=" - - - "_N_" prescription"_S_" - - -"
  1. ; Set DODETAIL=1 if we are doing prescription detail, 0 if not
  1. N DODETAIL S DODETAIL=1 ;(INFO("COUNT")'<^TMP("ABSPOS",$J,"DETAIL"))
  1. N RXI,I S RXI="" F I=1:1:INFO("COUNT") D
  1. .S RXI=$O(@DISP@(PAT,RXI))
  1. .N IEN52 S IEN52=$P(^ABSPT(RXI,1),U,11)
  1. .I I=1 D
  1. . . S INFO("PATIEN")=$P(^ABSPT(RXI,0),U,6)
  1. . . ;S INFO("PATIEN")=$P($G(^PSRX(IEN52,0)),U,2)
  1. .I 'DODETAIL D ; if not doing line item detail, summarize it
  1. ..S X=$$RESULT(RXI)
  1. ..I X]"" S INFO("RES",X)=$G(INFO("RES",X))+1
  1. ..N STAT S STAT=$P(@DISP@(PAT,RXI),U,2),INFO("STAT",STAT)=$G(INFO("STAT",STAT))+1
  1. Q
  1. INFO8 ; retally the counts of rejected, not electronic, payable
  1. ; This could be necessary if a prescription was rejected, then
  1. ; resubmitted with corrections, and then paid - it would have been
  1. ; counted in two different buckets.
  1. ; Given X = the current value of @DISP@(PAT)
  1. ; Fix X and also store the fixed-up version in @DISP@(PAT,RXI)
  1. S $P(X,U,5,9)="0^0^0^0^0" ; reset the counts
  1. N RXI S RXI="" F S RXI=$O(@DISP@(PAT,RXI)) Q:RXI="" D INFO9
  1. S @DISP@(PAT)=X
  1. Q
  1. INFO9 ; Given X, PAT, RXI, @DISP@(PAT,RXI)
  1. N B S B=$$BUCKET(RXI)
  1. S $P(X,U,B)=$P(X,U,B)+1
  1. Q
  1. BUCKET(RXI) ;EP - from ABSPOS6I
  1. ; for ^TMP("ABSPOS",$J,"DISP") pieces
  1. N R S R=$E($$RSPTYP(RXI))
  1. N V S V=$G(^ABSPT(RXI,4))
  1. I R="P" Q 7
  1. I R="" Q 6
  1. I R="R" Q $S(V:8,1:5)
  1. I R="A" Q 9
  1. Q 6 ; NEED A VALID BUCKET, EVEN IF THIS IS THE WRONG ONE
  1. ; 5 if rejected claim
  1. ; 6 if other failure
  1. ; 7 if paid
  1. ; 8 if rejected reversal
  1. ; 9 if accepted reversal
  1. RESULT(RXI) ;EP - from ABSPOSIV
  1. N REC,RES,M S M=240 S REC(2)=$G(^ABSPT(RXI,2))
  1. I REC(2)="" Q ""
  1. N RES S RES=$P(REC(2),U),REC(2)=$P(REC(2),U,2,$L(REC(2),U))
  1. I RES=1 Q REC(2)
  1. I RES'=0 Q REC(2)_" (code "_RES_")"
  1. ; RES=0, good, we can go to the claim response and see what it says
  1. N RSP D RESPINFO^ABSPOSQ4(RXI,.RSP)
  1. ; Rework this - 10/28/2000 - because Oklahoma Medicaid seems to
  1. ; make Packet Header Rejected, even though the Header is acceptable.
  1. ; But apparently if all the prescriptions are rejected, they give
  1. ; you a rejected packet header. Or maybe if it's a patient-level
  1. ; problem, they do that. Anyhow, the change made today is to always
  1. ; print individual prescription rejection reasons and to push the
  1. ; "PACKET HEADER REJECTED" message to the end.
  1. D ;
  1. .;S RES=RSP("RSP") ; prescription response status
  1. .S RES=$G(RSP("RSP")) ; prescription response status IHS/OIT/SCR patch 29
  1. .I RES="Rejected" D
  1. ..S RES=RES_"("
  1. ..N I F I=1:1:RSP("REJ",0) D
  1. ...I I'=1 S RES=RES_","
  1. ...S RES=RES_RSP("REJ",I)
  1. ...I $L(RES)>M S RES=$E(RES,1,M)
  1. ..S RES=RES_")"
  1. ;I RSP("MSG")]"" S RES=RES_"; "_RSP("MSG") ; and any extra message
  1. I $G(RSP("MSG"))]"" S RES=RES_"; "_RSP("MSG") ; and any extra message
  1. ;I RSP("HDR")'="Accepted" D ;packet header not accepted
  1. I $G(RSP("HDR"))'="Accepted" D ;packet header not accepted
  1. .;I RSP("HDR")="" S RSP("HDR")="?status null?"
  1. .I $G(RSP("HDR"))="" S RSP("HDR")="?status null?" ;IHS/OIT/SCR 05/15/09 patch 31
  1. .S RES=RES_";PACKET HEADER "_RSP("HDR")
  1. Q $E(RES,1,M)
  1. RSPTYP(RXI) ; quicker version of RESULT
  1. ; returns P payable, R rejected, or C or D, or "" if no resp packet
  1. N RSP D RESPINFO^ABSPOSQ4(RXI,.RSP)
  1. Q $G(RSP("RSP"))
  1. ;