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

DGPTODT1.m

Go to the documentation of this file.
DGPTODT1 ;ALB/BOK - PTF DRG TRIM POINT REPORT ; 9/13/01 4:56pm
 ;;5.3;Registration;**375**;Aug 13, 1993
 D QUIT,MCT:$D(^UTILITY($J,"DGPTFR","D")),SVC:$D(^UTILITY($J,"DGPTFR","SB")) W @IOF
QUIT K %,A1,A2,A3,B4,B,B1,B2,C1,C2,C3,C4,C5,D,D1,D2,D3,DGAT1,DGBT1,DGCPG,DGFLAG,DGTCH,DGWT1,E,E1,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,G,G1,G2,G3,M1,M2,M3,M4,M5,P,P1,P3,S,T,T1,T2,T3,W1,W2,X,X1,X2,Z,Y,^UTILITY($J,"DGTC") Q
MCT S P=0,DGFLAG="Medical Center",P3="DRG" D INIT,TINIT,COV^DGPTODT2,HEAD^DGPTODT2 F D2=0:0 S D2=$O(^UTILITY($J,"DGPTFR","D",D2)) Q:D2'>0  S D3=^(D2) D MTRIM^DGPTODT2,TWWU,PRINT
 D TOT,PP,TP^DGUTL
 Q
SVC S P=0,(DGFLAG,P3)="Service" D TINIT,INIT,COV^DGPTODT2 S G=0
 F G1=0:0 S G=$O(^UTILITY($J,"DGPTFR","SB",G)) Q:G']""  S (G2,P1)=^(G) D CONVS:T]"",TOT:C1,STOT:C1,INIT,HEAD^DGPTODT2 F D=0:0 S D=$O(^UTILITY($J,"DGPTFR","SB",G,D)) Q:D'>0  S G3=G2 D SVC1
 S G3=G2 D CONVS,STOT,TOT S DGFLAG="Medical Center" D HEAD^DGPTODT2,LAST,CONV,CONVB S DGFLAG="Medical Center",^UTILITY($J,"DGTC","MEDICAL CENTER",P)="" D TOT,PP,TP^DGUTL
BS S P=0,(DGFLAG,P3)="Specialty" D MI,INIT,TINIT,COV^DGPTODT2 S G=0 F G1=0:0 S G=$O(^UTILITY($J,"DGPTFR","SB",G)) Q:G']""  S G2=^(G) D CONV:C1,MT:F1,INIT,TINIT,HEAD^DGPTODT2,BT S D=G2
 D CONV,CONVB,PP,TP^DGUTL
 Q
BT F D=0:0 S D=$O(^UTILITY($J,"DGPTFR","SB",G,D)) Q:D'>0  S (B,P1)=^(D) D TOT:C1,INIT W !!?15,B F D2=0:0 S D2=$O(^UTILITY($J,"DGPTFR","SB",G,D,D2)) Q:D2'>0  S D3=^(D2) D BSTRIM^DGPTODT2,TWWU,PRINT
 D TOT Q
SVC1 F D2=0:0 S D2=$O(^UTILITY($J,"DGPTFR","SB",G,D,D2)) Q:D2'>0  S D3=^(D2) D TSET^DGPTODT2,TWWU S $P(^UTILITY($J,"DGPTFR","T",D2),U,13)=$P(D3,U,3,7)
 Q
TWWU S T=$P(D3,U,2)*$P(D3,U,6)+($P(DGBT1,U,4)*DG1DAWW)+($P(DGAT1,U,3)*DGHIWW),T=$S(T=0:$P(D3,U,6),1:T),T=T+$S($P(D3,U,3):+$P(DGBT1,U,5)/$P(D3,U,3)*$P(D3,U,6),1:0),T1=T*$P(DGCST,U,2)
 I DGFLAG["Serv" S Z=^UTILITY($J,"DGPTFR","T",D2),$P(^UTILITY($J,"DGPTFR","T",D2),U,4)=$P(Z,U,4)+T,$P(^UTILITY($J,"DGPTFR","T",D2),U,5)=$P(Z,U,5)+T1
 Q
INIT K ^UTILITY($J,"DGPTFR","T") S (C1,C2,C3,C4,C5,T1,B1,B2,B5,W1,W2,A1,A2,A3,B4)=0,T="" Q
TINIT S (F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13)=0 Q
MI S (M1,M2,M3,M4,M5)=0 Q
CONV F E=1:1:5 S @("C"_E)=@("F"_E)
 I DGFLAG["Spec" S DGFLAG="Service" D LAST2,CONVB,TOT S DGFLAG="Specialty"
 Q
CONVB S B1=F6,B2=F7,W1=F8,W2=F9,A1=F10,A2=F11,A3=F12,B4=F13 Q
CONVS F E1=0:0 S E1=$O(^UTILITY($J,"DGPTFR","T",E1)) Q:E1'>0  S Z=^(E1),D2=E1,D3=+Z_U_$P(Z,U,3)_U_$P(Z,U,13,17),DGBT1=$P(Z,U,6,7),DGWT1=$P(Z,U,8,9),DGAT1=$P(Z,U,10,12),T=$P(Z,U,4),T1=$P(Z,U,5) D PRINT
 Q
PRINT D HEAD^DGPTODT2:$Y>(IOSL-11) W !,$J(D2,3),$J($P(D3,U,3),5),$J($P(D3,U,4),6),$J($P(D3,U,5),6),$J($P(D3,U,6),9),$J($P(D3,U,7),7),"  |"
 W $J($P(DGBT1,U,2),6)," |",$J($P(DGWT1,U,2),7),$J(+DGWT1,8)," |",$J($P(DGAT1,U,2),7),$J($P(DGAT1,U,3),8),$J(+DGAT1,8)
 W ?88,"|",$J($P(D3,U,2),8),$J(+D3,11) S X=T,X2=2 D COMMA^%DTC W $J(X,12) S X=T*$P(DGCST,U,2)   ;S X=0 D COMMA^%DTC W $J(X,12)
 S C1=C1+$P(D3,U,2),C3=+D3+C3,C4=C4+T,C5=C5+T1,C2=C2+B4 Q
TOT W ! F E=1:1:132 W $S(DGFLAG["Serv":"-",1:"=")
TOT1 W !?8,"Total for ",DGFLAG,?38,"|",$J(B2,6)," |",$J(W2,7),$J(W1,8)," |",$J(A2,7),$J(A1,8),$J(A3,8),?88,"|",$J(C1,8),$J(C3,11) S X=C4,X2=2 D COMMA^%DTC W $J(X,12) W $J(C4/C1,12,2)   ;S C5=0 S (X,T3)=C5,X2="2$" D COMMA^%DTC W $J(X,12)
 I B4 W !?15,"Total 1 Day Stays:",$J(B4,12)
 Q
STOT S F1=F1+C1,F2=F2+C2,F3=F3+C3,F4=F4+C4,F5=F5+C5,S(G3)=C1_U_C2_U_C3_U_C4_U_C5_U_B2_U_B1_U_W2_U_W1_U_A2_U_A1_U_A3_U_B4 Q
MT S M1=M1+F1,M2=M2+F2,M3=M3+F3,M4=M4+F4,M5=M5+F5 Q
LAST S D=0 F D1=0:0 S D=$O(S(D)) Q:D']""  D LAST1 F E=1:1:5 S @("C"_E)=$P(S(D),U,E) S DGFLAG=D D TOT1:E=5
 Q
LAST2 S:'$D(S(D)) S(D)="" F E=1:1:5 S @("C"_E)=$P(S(D),U,E)
LAST1 S B1=$P(S(D),U,7),B2=$P(S(D),U,6),W2=$P(S(D),U,8),W1=$P(S(D),U,9),A1=$P(S(D),U,11),A2=$P(S(D),U,10),A3=$P(S(D),U,12),F6=F6+B1,F7=F7+B2,F8=F8+W1,F9=F9+W2,F10=F10+A1,F11=F11+A2,F12=F12+A3,B4=$P(S(D),U,13)
 Q
PP S %=$S($Y>(IOSL-11):($Y+2),1:IOSL-11) F E=$Y:1:% W ! I E=(%-1) D DIS^DGPTOD1 W !!?62,"-",P,"-"
 Q