source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTODT1.m@ 1087

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1DGPTODT1 ;ALB/BOK - PTF DRG TRIM POINT REPORT ; 9/13/01 4:56pm
2 ;;5.3;Registration;**375**;Aug 13, 1993
3 D QUIT,MCT:$D(^UTILITY($J,"DGPTFR","D")),SVC:$D(^UTILITY($J,"DGPTFR","SB")) W @IOF
4QUIT 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
5MCT 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
6 D TOT,PP,TP^DGUTL
7 Q
8SVC S P=0,(DGFLAG,P3)="Service" D TINIT,INIT,COV^DGPTODT2 S G=0
9 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
10 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
11BS 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
12 D CONV,CONVB,PP,TP^DGUTL
13 Q
14BT 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
15 D TOT Q
16SVC1 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)
17 Q
18TWWU 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)
19 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
20 Q
21INIT K ^UTILITY($J,"DGPTFR","T") S (C1,C2,C3,C4,C5,T1,B1,B2,B5,W1,W2,A1,A2,A3,B4)=0,T="" Q
22TINIT S (F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13)=0 Q
23MI S (M1,M2,M3,M4,M5)=0 Q
24CONV F E=1:1:5 S @("C"_E)=@("F"_E)
25 I DGFLAG["Spec" S DGFLAG="Service" D LAST2,CONVB,TOT S DGFLAG="Specialty"
26 Q
27CONVB S B1=F6,B2=F7,W1=F8,W2=F9,A1=F10,A2=F11,A3=F12,B4=F13 Q
28CONVS 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
29 Q
30PRINT 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)," |"
31 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)
32 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)
33 S C1=C1+$P(D3,U,2),C3=+D3+C3,C4=C4+T,C5=C5+T1,C2=C2+B4 Q
34TOT W ! F E=1:1:132 W $S(DGFLAG["Serv":"-",1:"=")
35TOT1 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)
36 I B4 W !?15,"Total 1 Day Stays:",$J(B4,12)
37 Q
38STOT 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
39MT S M1=M1+F1,M2=M2+F2,M3=M3+F3,M4=M4+F4,M5=M5+F5 Q
40LAST 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
41 Q
42LAST2 S:'$D(S(D)) S(D)="" F E=1:1:5 S @("C"_E)=$P(S(D),U,E)
43LAST1 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)
44 Q
45PP S %=$S($Y>(IOSL-11):($Y+2),1:IOSL-11) F E=$Y:1:% W ! I E=(%-1) D DIS^DGPTOD1 W !!?62,"-",P,"-"
46 Q
Note: See TracBrowser for help on using the repository browser.