source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSRDT1.m@ 862

Last change on this file since 862 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1BPSRDT1 ;BHAM ISC/FCS/DRS/FLS/DLF - Turn Around Time Statistics Report ;06/01/2004
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 N TRANDT,FR,TO,BPSSIZ,BPSTTAT,IEN57,IEN59,IEN,UPDT,SEQ,ENDLOOP,BPSTATIM
6 N BPSBGN,BPSBTIM,BPSCTIM,BPSEND,BPSETIM,BPSGTIM,BPSRTIM,BPSSTIM
7 N BPSBDT,BPSCNT,X,Y,BPSQUIT,MES,TYPE,DATA
8 K ^TMP("BPSRDT1",$J)
9 ;
10 ; Get start/end dates. Quit if no dates entered
11 D DATE I Y<0 K DTOUT Q
12 ;
13 ; Initialize variables
14 S TRANDT=FR,BPSSIZ=0,BPSTTAT=0,BPSCNT=0
15 ;
16 ; Quit if no dates in X-ref that match
17 I '$O(^BPSTL("AH",TRANDT)) G QUIT
18 ;
19 ; Loop through the dates and build temporary list
20 F S TRANDT=$O(^BPSTL("AH",TRANDT)) Q:TRANDT=""!($P(TRANDT,".")>TO) D
21 . S IEN57=""
22 . F S IEN57=$O(^BPSTL("AH",TRANDT,IEN57)) Q:IEN57="" D
23 .. S IEN59=$P($G(^BPSTL(IEN57,0)),U,1)
24 .. I 'IEN59 Q
25 .. S IEN=$$EXISTS^BPSOSL1(IEN59)
26 .. I IEN S ^TMP("BPSRDT1",$J,1,IEN59)=IEN
27 ;
28 ; Loop through the temporary list and build second list with turn-around stats
29 S IEN59=""
30 F S IEN59=$O(^TMP("BPSRDT1",$J,1,IEN59)) Q:IEN59="" D
31 . S IEN=$G(^TMP("BPSRDT1",$J,1,IEN59))
32 . S ENDLOOP=0
33 . S (BPSBDT,BPSBGN,BPSEND,BPSBTIM,BPSGTIM,BPSCTIM,BPSSTIM,BPSRTIM,BPSETIM,TYPE)=""
34 . S UPDT=FR F S UPDT=$O(^BPS(9002313.12,IEN,10,"B",UPDT)) Q:UPDT="" D Q:ENDLOOP
35 .. S SEQ="" F S SEQ=$O(^BPS(9002313.12,IEN,10,"B",UPDT,SEQ)) Q:SEQ="" D Q:ENDLOOP
36 ... S MES=$$UP($P($G(^BPS(9002313.12,IEN,10,SEQ,1)),U,1))
37 ... I MES="" Q
38 ... I MES["BEFORE SUBMIT OF " D
39 .... S TYPE=$P(MES,"BEFORE SUBMIT OF ",2)
40 .... S BPSBDT=$P(UPDT,".",1)
41 .... I BPSBDT>TO S BPSBDT="",ENDLOOP=1 Q
42 .... S BPSBGN=$$TIME2(UPDT),BPSBTIM=$$TIME(UPDT)
43 .... S (BPSEND,BPSGTIM,BPSCTIM,BPSSTIM,BPSRTIM,BPSETIM)=""
44 ... I ENDLOOP=1 Q
45 ... I BPSBDT,MES["BPSOSU NOW RESUBMIT"!(MES["BPSOSU-NOW RESUBMIT") D
46 .... S TYPE="Request portion of a Reversal/Resubmit"
47 .... S BPSBGN=$$TIME2(UPDT),BPSBTIM=$$TIME(UPDT)
48 .... S (BPSEND,BPSGTIM,BPSCTIM,BPSSTIM,BPSRTIM,BPSETIM)=""
49 ... I BPSBGN="" Q
50 ... I MES["INITIATING REVERSAL AND AFTER THAT, CLAIM WILL BE RESUBMITTED" S TYPE="Reversal portion of a Reversal/Resubmit"
51 ... I MES["GATHERING"!(MES["VALIDATING THE BPS TRANSACTION") S BPSGTIM=$$TIME(UPDT)
52 ... I MES["CREATED CLAIM ID" S BPSCTIM=$$TIME(UPDT)
53 ... I MES["BPSECMC2 - CLAIM - SENT"!(MES["BPSECMC2-CLAIM SENT") S BPSSTIM=$$TIME(UPDT)
54 ... I MES["BPSECMC2 - CLAIM - RESPONSE STORED"!(MES["BPSECMC2-RESPONSE STORED") S BPSRTIM=$$TIME(UPDT)
55 ... I MES["CLAIM - END"!(MES["BPSOSU-CLAIM COMPLETE") I BPSBGN D
56 .... S BPSEND=$$TIME2(UPDT),BPSETIM=$$TIME(UPDT)
57 .... D LOG
58 ;
59 ; If no data to report, quit
60 I 'BPSTTAT G QUIT
61 ;
62 ; Loop through list of stats and output
63 S BPSCNT="",BPSQUIT=0
64 F S BPSCNT=$O(^TMP("BPSRDT1",$J,2,BPSCNT)) Q:BPSCNT="" D I BPSQUIT=1 Q
65 . S DATA=$G(^TMP("BPSRDT1",$J,2,BPSCNT)),IEN59=$P(DATA,U,1),TYPE=$P(DATA,U,2)
66 . S TYPE=$S(TYPE="CLAIM":"Request",TYPE="REVERSAL":"Reversal",1:TYPE)
67 . W !,"For Prescription",?25,IEN59_" (Rx# "_$$RXAPI1^BPSUTIL1($P(IEN59,"."),.01,"I")_")"
68 . W !,"Type",?25,TYPE
69 . W !,"Date",?25,$$FMTE^XLFDT($P(DATA,U,3),"5Z")
70 . W !,"Begin ",?25,$P(DATA,U,4)
71 . W !,"Gathering information",?25,$P(DATA,U,5)
72 . W !,"Claim ID created",?25,$P(DATA,U,6)
73 . W !,"Claim Sent",?25,$P(DATA,U,7)
74 . W !,"Response stored ",?25,$P(DATA,U,8)
75 . W !,"Completed at",?25,$P(DATA,U,9)
76 . W !,"Turn-around time",?25,$P(DATA,U,10),!
77 . I BPSCNT#2=0 D
78 .. R !!,"Press RETURN to continue, '^' to exit: ",X:DTIME
79 .. I '$T!(X["^") S BPSQUIT=1
80 ;
81 ; Write Totals
82 W !!!,"Total number of claims",?25,BPSSIZ
83 W !,"Average Turn-around time",?25,BPSTTAT\BPSSIZ,!!
84 D PRESSANY^BPSOSU5()
85 ;
86 ; Kill scratch global
87 K ^TMP("BPSRDT1",$J)
88 Q
89 ;
90 ;
91TIME(%) ;
92 S %=$E($P(%,".",2)_"000000",1,6)
93 Q $E(%,1,2)_":"_$E(%,3,4)_":"_$E(%,5,6)
94 ;
95TIME2(%) ;
96 Q $P($$FMTH^XLFDT(%),",",2)
97 ;
98 ;
99LOG ;
100 I BPSBGN="" Q
101 I BPSEND="" Q
102 S BPSTATIM=$G(BPSEND)-$G(BPSBGN)
103 ;
104 ; Remove negative times (span midnight) and claims more than 20 minutes as anomolies
105 I BPSTATIM'>0 Q
106 ;I BPSTATIM>1200 Q
107 S BPSCNT=BPSCNT+1
108 S ^TMP("BPSRDT1",$J,2,BPSCNT)=IEN59_U_TYPE_U_BPSBDT_U_BPSBTIM_U_BPSGTIM_U_BPSCTIM_U_BPSSTIM_U_BPSRTIM_U_BPSETIM_U_BPSTATIM
109 S BPSTTAT=BPSTTAT+BPSTATIM
110 S BPSSIZ=BPSSIZ+1
111 I TYPE="Reversal/Resubmit" S BPSSIZ=BPSSIZ+1
112 S (BPSBGN,TYPE)=""
113 Q
114 ;
115DATE ; Ask user the date range
116 N %DT,VAL,TYPEVAL,X
117 S %DT="AEP",%DT(0)=-DT,%DT("A")="START WITH DATE: "
118 S %DT("B")="T-1"
119 D ^%DT Q:Y<0!($D(DTOUT))
120 S (%DT(0),FR)=Y
121 S %DT("A")="GO TO DATE: "
122 S %DT("B")="T"
123 D ^%DT Q:Y<0!($D(DTOUT))
124 S TO=Y
125 Q
126 ;
127UP(X) Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
128QUIT ;
129 W !!,"*** No valid data found ***",!!
130 D PRESSANY^BPSOSU5()
131 Q
Note: See TracBrowser for help on using the repository browser.