| 1 | ORPRPM1 ;DAN/SLC Performance Measure Print; ;10/4/01  10:45 | 
|---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**114,119**;Dec 17, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | ;This routine will print a report indicating the percent of | 
|---|
| 5 | ;orders entered for a provider by a provider holding the ORES key. | 
|---|
| 6 | ;The data for the report will be stored in ^TMP as follows: | 
|---|
| 7 | ;^TMP($J,"SUM",Provider Name,Patient Status)=Total # of order (universe)^Denominator^Numerator^Verbal^Written^Telephone^Policy^Electronically entered^Student entered^Outpatient narcotic orders | 
|---|
| 8 | ;Where Patient Status is I for inpatient or O for outpatient. | 
|---|
| 9 | ; | 
|---|
| 10 | PRINT ;Print out report | 
|---|
| 11 | S REPDT=$$FMTE^XLFDT($$DT^XLFDT) | 
|---|
| 12 | ;Detailed Report Section | 
|---|
| 13 | I ORREP="B"!(ORREP="D") D  Q:$G(ORSTOP)  ;print detailed report if selected | 
|---|
| 14 | .D HDR("D") I '$D(^TMP($J,"DET")) W !,"There is no data for the criteria you selected." S ORSTOP=1 Q | 
|---|
| 15 | .S ORI="" F  S ORI=$O(^TMP($J,"DET",ORI)) Q:ORI=""!($G(ORSTOP))  W !,"PROVIDER: ",ORI,!! S ORJ="" F  S ORJ=$O(^TMP($J,"DET",ORI,ORJ)) Q:ORJ=""!($G(ORSTOP))  D | 
|---|
| 16 | ..W $$FMTE^XLFDT($P(^OR(100,ORJ,8,1,0),"^")\1,2),?9,$J(ORJ,9) | 
|---|
| 17 | ..S ORPAT=$P(^OR(100,ORJ,0),"^",2) W ?20,$S(ORPAT["DPT":$E($P(^DPT(+ORPAT,0),"^"),1)_$E($P(^(0),"^",9),6,9),1:"Refrl") ;Print 1st letter of last name/last 4 SSN if patient file entry else referral | 
|---|
| 18 | ..W ?27,$S($P($G(^OR(100,ORJ,.1,1,0)),"^"):$E($P(^ORD(101.43,$P(^(0),"^"),0),"^"),1,12),1:"") | 
|---|
| 19 | ..W ?41,$S($P($G(^OR(100,ORJ,8,1,0)),"^",12):$E($P(^ORD(100.02,$P(^(0),"^",12),0),"^"),1,3),1:"") | 
|---|
| 20 | ..W ?47,$S($P($G(^OR(100,ORJ,0)),"^",10):$E($P(^SC(+$P(^(0),"^",10),0),"^"),1,12),1:"") | 
|---|
| 21 | ..W ?61,$S($P($G(^OR(100,ORJ,0)),"^",14):$E($P(^DIC(9.4,$P(^(0),"^",14),0),"^"),1,11),1:"") | 
|---|
| 22 | ..W ?77,$S(^TMP($J,"DET",ORI,ORJ):"Y",1:"N"),! I $Y>(IOSL-4) D HDR("D") | 
|---|
| 23 | .Q:$G(ORSTOP) | 
|---|
| 24 | ;Summary report section | 
|---|
| 25 | I ORREP="B"!(ORREP="S") D  Q:$G(ORSTOP)  ;print summary report if selected | 
|---|
| 26 | .D HDR("S") Q:$G(ORSTOP)  I '$D(^TMP($J,"SUM")) W !,"There is no data for the criteria you selected." S ORSTOP=1 Q | 
|---|
| 27 | .S ORI="" F  S ORI=$O(^TMP($J,"SUM",ORI)) Q:ORI=""!($G(ORSTOP))  D  Q:$G(ORSTOP)  D SUBTOT:'ORFS | 
|---|
| 28 | ..S ORWROTE=0 K ORSTOT F ORP="I","O" Q:$G(ORSTOP)  I $D(^TMP($J,"SUM",ORI,ORP)) D | 
|---|
| 29 | ...I 'ORFS D  ;If not summary total only then write provider specific information | 
|---|
| 30 | ....W:'ORWROTE $E(ORI,1,25),! S ORWROTE=1 W ?1,$S(ORP="I":" Inpt",1:"Outpt")," Tot" | 
|---|
| 31 | ....W ?12,$J(+$P(^TMP($J,"SUM",ORI,ORP),"^"),6) I $P(^(ORP),"^")'=$P(^(ORP),"^",2) W ?19,$J(+$P(^(ORP),"^",10)_"/"_+$P(^(ORP),"^",9)_"/"_+$P(^(ORP),"^",8),15) ;Universe DEA Wet Sig Reqd/Student/Policy | 
|---|
| 32 | ....W ?34,$J(+$P(^TMP($J,"SUM",ORI,ORP),"^",2),8),?44,$J(+$P(^(ORP),"^",3),8),?53,$S(+$P(^(ORP),"^",2)'=0:$J($P(^(ORP),"^",3)/$P(^(ORP),"^",2)*100,3,0)_"%",1:"NONE") | 
|---|
| 33 | ....I $P(^(ORP),"^",2)'=$P(^(ORP),"^",3) W ?58,+$P(^(ORP),"^",4),"/",+$P(^(ORP),"^",5),"/",+$P(^(ORP),"^",6),"/",+$P(^(ORP),"^",7) | 
|---|
| 34 | ....W ! | 
|---|
| 35 | ...F ORJ=1:1:10 S ORTOT(ORJ)=$G(ORTOT(ORJ))+$P(^(ORP),"^",ORJ),ORTOT(ORJ,ORP)=$G(ORTOT(ORJ,ORP))+$P(^(ORP),"^",ORJ) ;Overall totals | 
|---|
| 36 | ...S ORSTOT(1)=$G(ORSTOT(1))+$P(^(ORP),"^"),ORSTOT(2)=$G(ORSTOT(2))+$P(^(ORP),"^",2),ORSTOT(3)=$G(ORSTOT(3))+$P(^(ORP),"^",3) | 
|---|
| 37 | ...I $Y>(IOSL-4) D HDR("S") | 
|---|
| 38 | .Q:$G(ORSTOP) | 
|---|
| 39 | .I 'ORFS W $$REPEAT^XLFSTR("-",78) | 
|---|
| 40 | .F ORP="I","O" I $D(ORTOT(1,ORP)) D | 
|---|
| 41 | ..W !,$S(ORP="I":"INPT",1:"OUTPT"),?10,$J($G(ORTOT(1,ORP)),8),?19,$J(+$G(ORTOT(10,ORP))_"/"_+$G(ORTOT(9,ORP))_"/"_+$G(ORTOT(8,ORP)),15) | 
|---|
| 42 | ..W ?34,$J($G(ORTOT(2,ORP)),8),?44,$J($G(ORTOT(3,ORP)),8),?53,$S(+$G(ORTOT(2,ORP))'=0:$J($G(ORTOT(3,ORP))/$G(ORTOT(2,ORP))*100,3,0)_"%",1:"NONE") | 
|---|
| 43 | ..W ?58,+$G(ORTOT(4,ORP)),"/",+$G(ORTOT(5,ORP)),"/",+$G(ORTOT(6,ORP)),"/",+$G(ORTOT(7,ORP)) | 
|---|
| 44 | .W !,"TOTAL",?10,$J($G(ORTOT(1)),8),?19,$J(+$G(ORTOT(10))_"/"_+$G(ORTOT(9))_"/"_+$G(ORTOT(8)),15) | 
|---|
| 45 | .W ?34,$J(ORTOT(2),8),?44,$J(ORTOT(3),8),?53,$S(+ORTOT(2)'=0:$J(ORTOT(3)/ORTOT(2)*100,3,0)_"%",1:"NONE"),?58,+$G(ORTOT(4)),"/",+$G(ORTOT(5)),"/",+$G(ORTOT(6)),"/",+$G(ORTOT(7)) | 
|---|
| 46 | Q | 
|---|
| 47 | ; | 
|---|
| 48 | SUBTOT ;Print individual sub totals | 
|---|
| 49 | W ?1,"  Sub-tot",?12,$J($G(ORSTOT(1)),6),?34,$J($G(ORSTOT(2)),8),?44,$J($G(ORSTOT(3)),8) | 
|---|
| 50 | W ?53,$S(+ORSTOT(2)'=0:$J($G(ORSTOT(3))/$G(ORSTOT(2))*100,3,0)_"%",1:"NONE"),! | 
|---|
| 51 | Q | 
|---|
| 52 | ; | 
|---|
| 53 | HDR(TYPE) ;Print appropriate header | 
|---|
| 54 | I $E(IOST,1,2)="C-"&($G(PG)) S DIR(0)="E" D ^DIR S ORSTOP='Y K DIR Q:ORSTOP | 
|---|
| 55 | I $G(PG)!('$G(PG)&($E(IOST,1,2)="C-")) W @IOF | 
|---|
| 56 | S PG=$G(PG)+1 | 
|---|
| 57 | W !,"CPRS Performance Monitor ",$S(TYPE="D":"- Detailed",ORFS:"- Summary Totals",1:"- Summary")," Report",?52,REPDT,?72,"PAGE ",$G(PG),!,"Selected Date Range: ",$$FMTE^XLFDT(ORSD+.1,2)," to ",$$FMTE^XLFDT(ORED\1,2),! | 
|---|
| 58 | W "Sort criteria: ",$S(ORPT="I":"IN",ORPT="O":"OUT",1:"ALL "),"PATIENTS/",$S(ORTYPE="P":"PHARMACY",1:"ALL")," ORDERS" | 
|---|
| 59 | I TYPE="D" W ?72,"ENTERED",!,"ORDER",?41,"ORD",?47,"PATIENT",?73,"BY HAS",!,"DATE",?11,"ORDER #",?19,"PAT ID",?27,"1st ORD ITEM",?41,"TYPE",?47,"LOCATION",?61,"PACKAGE",?74,"ORES?",! | 
|---|
| 60 | I TYPE="S" W ?58,"BREAKDOWN OF ORDERS",!,?34,"PROVIDER",?44,"PROVIDER",?58,"NOT SELF ENTERED",! W:'ORFS "PROVIDER" W ?10,"UNIVERSE",?23,"DEA/STU/POL",?36,"ORDERS",?45,"ENTERED",?56,"%",?58,"WR/VE/TE/EL",! | 
|---|
| 61 | W $$REPEAT^XLFSTR("-",IOM),! | 
|---|
| 62 | Q | 
|---|
| 63 | ; | 
|---|