source: FOIAVistA/trunk/r/HEALTH_SUMMARY-GMTS/GMTSOBT.m@ 1492

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

initial load of FOIAVistA 6/30/08 version

File size: 7.8 KB
Line 
1GMTSOBT ; SLC/KER - HS Object - Time and Type ; 01/06/2003
2 ;;2.7;Health Summary;**58**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10104 $$UP^XLFSTR
6 ; DBIA 10088 ENDR^%ZISS
7 ; DBIA 10026 ^DIR
8 ;
9 Q
10TP ; Time Period
11 Q:+($G(GMTSQ))>0 N X,Y,DIR,GMTSX,GMTSDEF K GMTSOBJ("TIME")
12 S GMTSDEF=$$TIM($P($G(^GMT(142.5,+($G(GMTSDA)),0)),U,4))
13 S DIR("A")=" Enter REPORT PERIOD: ",DIR("B")="3M" S:$L(GMTSDEF) DIR("B")=GMTSDEF
14 S DIR(0)="FAO^2;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
15 S (DIR("?"),DIR("??"))="^D TH^GMTSOBT"
16 D ^DIR S:$D(DIROUT)!($D(DTOUT)) GMTSQ=1
17 Q:+($G(GMTSQ))>0 Q:'$L($G(GMTSX)) W " ",GMTSX S GMTSOBJ("TIME")=$G(GMTSX)
18 Q
19TH ; Time Help
20 D ATTR
21 W !," Enter a time limit for the Health Summary report/object. It"
22 W !," must be in the format of a numeric time length and an alpha"
23 W !," time unit, and can not exceed 5 characters. If no time unit"
24 W !," is provided, then the time unit will be set to Days (D), i.e.,"
25 W !," "
26 W !,$G(BOLD)," 11, 2D, 4D, 6W, 18W, 3M, 6M, 1Y",$G(NORM)
27 D KATTR
28 Q
29TIM(X) ; Input Transform for Time
30 Q:$L(X)=1&(X="@") X S X=$$UP^XLFSTR($G(X)) Q:$L($G(X))>5 "" Q:$L((+($G(X))))>4 "" S X=$G(X)
31 N GMTSLEN,GMTSUNIT S GMTSLEN=+X,GMTSUNIT=$E(X,$L(X)) S:+GMTSUNIT>0 GMTSUNIT="D" S:$L(GMTSLEN)=$L(X) GMTSUNIT="D"
32 Q:GMTSUNIT'="D"&(GMTSUNIT'="W")&(GMTSUNIT'="M")&(GMTSUNIT'="Y") ""
33 I GMTSUNIT="D",GMTSLEN>5 D
34 . N GMTSO S GMTSO=GMTSLEN I +GMTSLEN>89!(GMTSLEN#7=0)!(GMTSLEN#7=6) D
35 . . S GMTSLEN=GMTSLEN\7,GMTSUNIT="W"
36 . . S:GMTSO#7>3 GMTSLEN=GMTSLEN+1
37 . I GMTSUNIT="D",GMTSLEN#32>28 D
38 . . S GMTSLEN=GMTSLEN\32 S:GMTSO#32>28 GMTSLEN=GMTSLEN+1 S GMTSUNIT="M"
39 I GMTSUNIT="W",GMTSLEN>3 D
40 . N GMTSO S GMTSO=GMTSLEN I +GMTSLEN>23!(GMTSLEN#4=3)!(GMTSLEN#4=0) D
41 . . S GMTSLEN=GMTSLEN\4.333333333,GMTSUNIT="M"
42 . . S:GMTSO#4.333333333>3 GMTSLEN=GMTSLEN+1
43 I GMTSUNIT="M",GMTSLEN>11 D
44 . N GMTSO S GMTSO=GMTSLEN I GMTSLEN#12=11!(GMTSLEN#12=0) D
45 . . S GMTSLEN=GMTSLEN\12,GMTSUNIT="Y" S:GMTSO#12=11 GMTSLEN=GMTSLEN+1
46 S X=GMTSLEN_GMTSUNIT
47 Q X
48 ;
49TYPE(I) ; Select Type
50 ; Uses Fileman's DIC variables for Lookup
51 N GMTSHDR,GMTSNOQ,GMTSNOI,GMTSX,GMTSREDO
52TY2 ; Prompt for Type
53 S GMTSX=$$TYPE^GMTSULT I X["@" S X="@",Y=-1 Q -1
54 Q:+GMTSX'>0 -1
55 S GMTSHDR(1)="You have selected the following Health Summary Type to use as an Object:"
56 S GMTSHDR(2)=" ",GMTSNOQ="",GMTSNOI="",GMTSREDO=0
57 D DT^GMTSOBD(+GMTSX) I $D(^TMP("GMTSOBT",$J)) D
58 . D NOQUE^GMTSOBD W ! N DIR,DTOUT,DUOUT S DIR(0)="YAO",DIR("A")="Is this correct? ",DIR("B")="Y"
59 . D ^DIR S:$$UP^XLFSTR($E(X,1))="N" GMTSREDO=1 I +Y'>0 S GMTSX=-1
60 W:+GMTSREDO>0 ! G:+GMTSREDO>0 TY2
61 D XY(GMTSX) S I=GMTSX K ^TMP("GMTSOBT",$J)
62 Q I
63 ;
64RP(TYPE,OBJ) ; Report Period
65 ; Input TYPE Required, Health Summary Type IEN
66 ; OBJ Optional, Health Summary Object IEN
67 ;
68 ; Output X Report Period, "" or "@"
69 ; GMTSQ Up Arrow/Time Out
70 ;
71 Q:+($G(GMTSQ))>0 "" N X,Y,DIR,GMTSX,GMTSDEF,GMTSS,GMTSTY,GMTSOB K GMTSOBJ("TIME") S GMTSOB=+($G(OBJ)),GMTSTY=+($G(TYPE)) Q:+GMTSTY=0 "@"
72 S GMTSS=$$RT(GMTSTY) Q:+($G(GMTSQ))>0 -1 Q:GMTSS'>0 "@"
73 S GMTSDEF=$$TIM($P($G(^GMT(142.5,+($G(GMTSDA)),0)),U,4))
74 S DIR("A")=" Enter new TIME LIMIT: " S:$L(GMTSDEF) DIR("B")=GMTSDEF
75 S DIR(0)="FAO^1;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
76 S (DIR("?"),DIR("??"))="^D TH^GMTSOBT" W ! D ^DIR I X="@",Y="" Q X
77 S:$D(DIRUT)!($D(DIROUT))!($D(DTOUT))!($D(DUOUT)) GMTSQ=1 Q:+($G(GMTSQ))>0 -1
78 Q:'$L($G(GMTSX)) "" W " ",GMTSX S GMTSOBJ("TIME")=$G(GMTSX)
79 S X=GMTSX
80 Q X
81RT(X) ; Report Period or Time Limits
82 ; Input X IEN or Health Summary Type
83 Q:+($G(GMTSQ))>0 -1 N Y,DIR,GMTSX S GMTSX=+($G(X)) D RTA(+GMTSX)
84 I '$D(DIR("A")) S DIR("A",1)=" Overwrite Health Summary Type Time Limits ",DIR("A")=" with Health Summary Object Report Period? "
85 S DIR(0)="YAO",DIR("B")="N",(DIR("?"),DIR("??"))="^D RTH^GMTSOBT(GMTSX)"
86 W ! D ^DIR S:$D(DIRUT)!($D(DIROUT))!($D(DTOUT))!($D(DUOUT)) GMTSQ=1
87 Q:+($G(GMTSQ))>0 -1 S X=+($G(Y))
88 Q X
89RTH(X) ; Report Period or Time Limits Help
90 ; Input X IEN or Health Summary Type
91 D LS(+($G(X))) W !
92 D ATTR
93 W !," Entering a new TIME LIMIT for the Health Summary Object will "
94 W !," overwrite the TIME LIMITS set the for individual components. "
95 W !," It must be alpha numeric and can not exceed 5 characters."
96 W !," Examples: ",$G(BOLD),"3D, 6W, 3M, 1Y",$G(NORM)
97 D KATTR
98 Q
99RTA(X) ; Report Period or Time Limit DIR(A)
100 D ATTR K DIR("A") N GMTSC,GMTST,GMTSP,GMTSS,GMTSR,GMTSI,GMTSN S GMTSI=+($G(X)) Q:+X'>0
101 S GMTSN=$P($G(^GMT(142,+GMTSI,0)),"^",1)
102 Q:'$L(GMTSN)
103 I $L(GMTSN) D
104 . S GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type '"
105 . S GMTST=GMTST_$$UP^XLFSTR(GMTSN)_"'?"
106 I '$L(GMTSN) D
107 . S GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type?"
108 F Q:'$L($$TRIM(GMTST)) D
109 . I $L(GMTST)'>60 S GMTSC=+($G(GMTSC))+1,DIR("A",GMTSC)=" "_$$TRIM(GMTST)_" ",GMTST="" Q
110 . S GMTSS=$E($$TRIM(GMTST),1,60),GMTSS=$P(GMTSS," ",1,($L(GMTSS," ")-1)),GMTSR=$P($$TRIM(GMTST),GMTSS,2,299),GMTST=GMTSR,GMTSC=+($G(GMTSC))+1,DIR("A",GMTSC)=" "_$$TRIM(GMTSS)_" "
111 S:+($G(GMTSC))>0 DIR("A")=DIR("A",GMTSC) K:+($G(GMTSC))>0 DIR("A",GMTSC)
112 S (GMTSC,GMTSI)=0 F GMTSC=1:1 D Q:GMTSI>0
113 . S:'$D(DIR("A",GMTSC)) GMTSS="DIR(""A"")",GMTSI=1
114 . S:$D(DIR("A",GMTSC)) GMTSS="DIR(""A"","_GMTSC_")"
115 . S GMTST=@GMTSS I GMTST["Time Limits" S GMTST=$P(GMTST,"Time Limits",1)_$G(BOLD)_"Time Limits"_$G(NORM)_$P(GMTST,"Time Limits",2),@GMTSS=GMTST Q
116 . S GMTST=@GMTSS I GMTST["Report Period" S GMTST=$P(GMTST,"Report Period",1)_$G(BOLD)_"Report Period"_$G(NORM)_$P(GMTST,"Report Period",2),@GMTSS=GMTST Q
117 . S GMTST=@GMTSS I GMTST["a Report" S GMTST=$P(GMTST,"a Report",1)_"a "_$G(BOLD)_"Report"_$G(NORM)_$P(GMTST,"a Report",2),@GMTSS=GMTST
118 . S GMTST=@GMTSS I GMTST["Period which" S GMTST=$P(GMTST,"Period which",1)_$G(BOLD)_"Period"_$G(NORM)_" which"_$P(GMTST,"Period which",2,299),@GMTSS=GMTST
119 D KATTR
120 Q
121LS(X) ; List Structure
122 D ATTR
123 N GMTST,GMTSS,GMTSC,GMTSTA,GMTSI,GMTSAB,GMTSOL,GMTSTL,GMTSNM,GMTSHD,GMTSCT
124 S GMTST=+($G(X)) Q:'$D(^GMT(142,+GMTST,0))!('$D(^GMT(142,+GMTST,1))) 0
125 S (GMTSCT,GMTSTA,GMTSI)=0
126 F S GMTSI=$O(^GMT(142,+GMTST,1,GMTSI)) Q:+GMTSI=0 D Q:+($G(GMTSCT))>1
127 . S GMTSS=$G(^GMT(142,+GMTST,1,GMTSI,0)),GMTSC=$G(^GMT(142.1,+($P(GMTSS,"^",2)),0)) Q:+($P(GMTSS,"^",4))'>0!($P(GMTSC,"^",3)'="Y")
128 . S GMTSOL=$P(GMTSS,"^",3) S:'$L(GMTSOL) GMTSOL="--" S GMTSTL=$P(GMTSS,"^",4),GMTSNM=$$EN2^GMTSUMX($P(GMTSC,"^",1))
129 . S GMTSHD=$P(GMTSC,"^",9) S:$L(GMTSHD) GMTSNM=GMTSNM S GMTSAB=$P(GMTSC,"^",4),GMTSCT=+($G(GMTSCT))+1
130 . I GMTSCT=1 D
131 . . W !," Example of Health Summary Type component ",$G(BOLD),"TIME LIMITS",$G(NORM),!
132 . . W !,?9,"Abbr",?15,"Component Name",?45,"Max Occurrences",?62,$G(BOLD),"Time Limits",$G(NORM)
133 . . W !,?9,"----------------------------------------------------------------"
134 . W !,?9,GMTSAB,?15,GMTSNM,?49,$J(GMTSOL,4),?63,$G(BOLD),$J(GMTSTL,5),$G(NORM)
135 D KATTR
136 Q
137TA(X) ; Time Limits Applicable
138 N GMTST,GMTSS,GMTSC,GMTSTA,GMTSI
139 S GMTST=+($G(X)) Q:'$D(^GMT(142,+GMTST,0))!('$D(^GMT(142,+GMTST,1))) 0
140 S (GMTSTA,GMTSI)=0
141 F S GMTSI=$O(^GMT(142,+GMTST,1,GMTSI)) Q:+GMTSI=0 D Q:+GMTSTA>0
142 . S GMTSS=$G(^GMT(142,+GMTST,1,GMTSI,0))
143 . S GMTSC=$G(^GMT(142.1,+($P(GMTSS,"^",2)),0))
144 . S:+($P(GMTSS,"^",4))>0&($P(GMTSC,"^",3)="Y") GMTSTA=1
145 S X=GMTSTA
146 Q X
147 ;
148 ; Miscellaneous
149TRIM(X) ; Trim Spaces
150 S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
151 F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
152 Q X
153XY(I) ; Set X and Y Variables
154 K Y,X S X=+($G(I)) I X'>0!('$D(^GMT(142,+X,0))) S Y=-1 Q
155 S Y=+X_"^"_$P($G(^GMT(142,+X,0)),"^",1),Y(0)=$G(^GMT(142,+X,0)),Y(0,0)=$P($G(^GMT(142,+X,0)),"^",1),Y(0,1)=$$EN^GMTSUMX(Y(0,0))
156 Q
157ATTR ; Set Screen Attributes
158 N X,IOINHI,IOINORM S X="IOINHI;IOINORM" D ENDR^%ZISS S BOLD=$G(IOINHI),NORM=$G(IOINORM) Q
159KATTR ; Kill Screen Attributes
160 K NORM,BOLD Q
Note: See TracBrowser for help on using the repository browser.