source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIH.m@ 1474

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1DIH ;SFISC/GFT-HISTOGRAM ;8:19 AM 28SEP2004
2 ;;22.0;VA FileMan;**2,61,144**;Mar 30, 1999;Build 5
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 I $O(^DOSV(0,IO(0),0))'>0 W !,$C(7),"NO SUB-COUNTS WERE RUN" Q
5 K ZTSK S:$D(^%ZTSK) %ZIS="QM" D ^%ZIS G ENDK:POP,QUE:$D(IO("Q"))
6DQ S J=$I,DN="=$O(^DOSV(0,J," F X=0:1 Q:'$D(^DOSV(0,J,"BY",X+1))
7 G END:'X S A=^(1),DD=$P(A,U,3) I $D(^DD(+A,+$P(A,U,2),0)) S DD=^(0)
8 S T=$P(DD,U,2),DP=$P(DD,U,3),DF=$S(T["S":1,T["P":2,T["D"!($P(A,U,7)["D"):3,1:0)
9 S DMX=DN_X,DX="",F=X
10F S DMX=DMX_",D"_F,DX=DX_"S D"_F_"="""" F X=X:0 S D"_F_DMX_")) Q:D"_F_"="""" "_$P("S X=X+1,DS(X)=0,DD(X)=0,DV(X)="_$E("-",$P(A,U,4)["-")_"D"_X_" ",U,F=X),F=F-1 G F:F
11 S DX=DX_"S:$D(^(D1,F,""N"")) DD(X)=DD(X)+^(""N"") S:$D(^(""S"")) DS(X)=DS(X)+^(""S"")"
12 I $E(IOST)="C" S DIFF=1
13 S F=-1,C="*",DIHIOM=IOM-23,DIHIOSL=IOSL-8 U IO W:$D(DIFF)&($Y) @IOF S DIFF=1
14I S @("F"_DN_"""F"",F))") I 'F G END
15 S X=0,T=^(F),DS=1 X DX S DIH=X
16 D MAX G I
17 ;
18MAX S DMX=0 F N=1:1:DIH S:DD(N)>DMX DMX=DD(N) D LBL:DS=1&DF S DV(N)=$E(DV(N),1,14)
19 S X=1 F S=1:1 S X=X*2 Q:DMX'>X
20 S D1=DMX+X\X*X F S=D1:-X/2 Q:S'>DMX S D1=S
21 S D2=DIHIOM*X/D1
22XX S X=X\2,D2=D2\2 I X>4,$L(X)+7<D2 G XX
23 I DMX S S=D1/DIHIOM,D1=D2 F X=1:1:DIH D HD:X=1!'(X-1#DIHIOSL),LN,TR:X=N!'(X#DIHIOSL) I Y=U Q
24SUM Q:$P(T,U,4)["D"!(Y=U) I DS=1 S DS=2 F N=1:1 G:N>DIH MAX S S=DD(N),DD(N)=DS(N),DS(N)=S
25MEAN I DS=2 S DS=3 F N=1:1 S DD(N)=$S(DS(N):DD(N)/DS(N),1:0) G MAX:N=DIH
26 Q
27 ;
28END W:($E(IOST)'="C")&($Y) @IOF K:$D(ZTSK) ^DOSV(0,IO) D CLOSE^DIO4
29ENDK K ZTSK,DIH,S,A,C,DD,DS,D1,D2,DN,T,DP,F,N,J,POP,DF,X,Y,DX,DMX,DV,DIHIOM,DIHIOSL,DIFF Q
30 ;
31LBL I DF=1 S D1=$F(DP,DV(N)_":") S:D1 DV(N)=$P($E(DP,D1,999),";",1) Q
32 I DF=2 S DV(N)=$P(@(U_DP_DV(N)_",0)"),U,1) Q
33 S DV(N)=$S($E(DV(N),4,5):+$E(DV(N),4,5)_"-",1:"")_$S($E(DV(N),6,7):+$E(DV(N),6,7)_"-",1:"")_(1700+$E(DV(N),1,3)) Q
34 ;
35HD U IO W:$Y+N+1>DIHIOSL @IOF W !! D W !! Q
36 .N H
37 .S H=$P("COUNT^SUM^MEAN",U,DS)_", "
38 .I $D(^DD(+T,0)) S Y=+$P(T,U,2) I Y>.01,$D(^(Y,0)) S H=H_$P(^(0),U)_", "
39 .S H=H_"BY "_$P(DD,U) W ?IOM-$L(H)-2,H
40LN W ?15-$L(DV(X))-1,DV(X)," |" F Y=1:1:DD(X)/S W C
41 W ! Q
42TR W ?15 F Y=0:1:DIHIOM W $E("-+",Y#D1=0+1)
43 W ! F Y=1:1:DIHIOM I Y#D1=0 S D2=$J(Y*S,0,0) W ?Y+15-($L(D2)\2),D2
44 I IOST?1"C".E W $C(7) R Y:DTIME
45 Q
46QUE ;
47 S ZTSAVE("^DOSV(0,$I,")=""
48 S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL,ZTRTN="DQ^DIH"
49 D ^%ZTLOAD K ZTSK G END
50 ;
Note: See TracBrowser for help on using the repository browser.