source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSXAL.m@ 1150

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

initial load of WorldVistAEHR

File size: 8.3 KB
RevLine 
[613]1GMTSXAL ; SLC/KER - List Parameters/Get List ; 02/27/2002
2 ;;2.7;Health Summary;**47,49,66**;Oct 20, 1995
3 Q
4 ;
5 ; External References in GMTSXAL
6 ; DBIA 2992 ^XTV(8989.5,
7 ; DBIA 2056 $$GET1^DIQ
8 ; DBIA 2263 GETLST^XPAR
9 ;
10GETLIST(GMTSL,GMTSUSR,GBL,ERR) ; Get Health Summary Type Parameter List
11 N GMTSCP,GMTSCPL,GMTSPRE,GMTSDEF,ROOT
12 I '$G(GBL) K GMTSL S ROOT=$NA(GMTSL)
13 I $G(GBL) D Q:$G(ERR)
14 . I $E($G(GMTSL),1)'="^" S ERR="19^"_$$EZBLD^DIALOG(19) Q
15 . S ROOT=GMTSL
16 S @ROOT=0
17 S GMTSUSR=+($G(GMTSUSR)) Q:+GMTSUSR'>0 Q:'$L($$UNM^GMTSXAW3(GMTSUSR))
18 S GMTSCPL=$$CPL(GMTSUSR),GMTSPRE=$$PRE(GMTSUSR)
19 D GETLST(.ROOT,GMTSUSR,GMTSCPL,GMTSPRE)
20 I $D(GMTSIDX) D
21 . S @ROOT@("AC","PRE")=GMTSPRE,@ROOT@("AC","CPL")=GMTSCPL_"^"_$S(+($G(GMTSCPL))'>0:"Overwrite",1:"Append")
22 . N GMTSI,GMTST,GMTSTO,GMTSTC,GMTSTCT,GMTSV,GMTSC
23 . S GMTSTO="",(GMTSC,GMTSTC,GMTSTCT,GMTSI)=0
24 . F S GMTSI=$O(@ROOT@(GMTSI)) Q:+GMTSI=0 D
25 . . S GMTSV=$G(@ROOT@(GMTSI)),GMTST=$G(@ROOT@("C",GMTSI)) Q:'$L(GMTST)
26 . . S GMTSC=GMTSC+1,@ROOT@("A",GMTST,0)=GMTSC,@ROOT@("A",GMTST,GMTSC)=GMTSV
27 . . S:GMTST'=GMTSTO GMTSTC=GMTSTC+1,GMTSTCT=0
28 . . S GMTSTCT=GMTSTCT+1
29 . . S @ROOT@("AB",0)=GMTSTC,@ROOT@("AB",+GMTSTC,0)=GMTSTCT,@ROOT@("AB",+GMTSTC,GMTSTCT)=GMTST_"^"_GMTSV,GMTSTO=GMTST
30 . K @ROOT@("B"),@ROOT@("C") S GMTST="" F S GMTST=$O(@ROOT@("A",GMTST)) Q:GMTST="" D
31 . . S GMTSI=0 F S GMTSI=$O(@ROOT@("A",GMTST,GMTSI)) Q:+GMTSI=0 D
32 . . . S GMTSC=+($G(@ROOT@("A",GMTST,GMTSI)))
33 . . . S GMTSV=$P($G(@ROOT@("A",GMTST,GMTSI)),"^",2)
34 . . . S:+GMTSC>0 @ROOT@("B",+GMTSC,GMTSI)=""
35 . . . S:$L(GMTSV)>0 @ROOT@("BA",GMTSV,GMTSI)=""
36 Q
37 ;
38GETILIST(GMTSL,GMTSUSR) ; Get Indexed Health Summary Types Parameter List
39 S GMTSUSR=+($G(GMTSUSR)) Q:GMTSUSR=0 Q:'$L($$UNM^GMTSXAW3(GMTSUSR))
40 N GMTSIDX S GMTSIDX=1 D GETLIST(.GMTSL,GMTSUSR)
41 Q
42 ;
43GETLST(ROOT,GMTSUSR,GMTSCPL,GMTSPRE) ; Get List
44 ;
45 ; Health Summary Version of call in GETHS^ORWRP:
46 ;
47 ; D GETLST^XPAR(.ORHSPARM,"ALL",
48 ; "ORWRP HEALTH SUMMARY TYPE LIST","N")
49 ;
50 ; Merges Health Summary Parameters for display in the
51 ; Health Summary Types on the Reports Tab. National
52 ; Health Summary Types (remote data views) are grouped
53 ; together and added to the list separately. For a
54 ; National Health Summary Type to be included on the list,
55 ; it must first be defined in the parameters file.
56 ; The merge of parameters is accomplished by either
57 ; appending or over-writing the parameters to the list.
58 ;
59 ; Input Variables
60 ;
61 ; GMTSL Local Array of Health Summary Parameters
62 ;
63 ; GMTSCPL Compile Method
64 ;
65 ; GMTSCPL=1 <DEFAULT> Append Parameters to List
66 ; GMTSCPL=0 Overwrite Parameters (by entity)
67 ;
68 ; GMTSPRE Precedence of Entities
69 ;
70 ; Having defined how the list is to be created using
71 ; GMTSCPL (Append or Overwrite), this variable
72 ; defines the order that each entity will be
73 ; referenced (first, second, etc.)
74 ;
75 ; FORMAT Series of 3 Characters, Uppercase taken
76 ; from the PARAMETER ENTITY file delimited
77 ; by semi-colons
78 ;
79 ; Default value: $$DEF^GMTSXAW
80 ;
81LST ; Create List
82 ;
83 N DIC,DTOUT,DUOUT,GMTSE,GMTSENT,GMTSER,GMTSI,GMTSLI,GMTSLL,GMTSLN
84 N GMTSPAR,GMTSYS,GMTSAD,GMTSAR,GMTST,GMTSV,GMTSVAL,GMTSII
85 N GMTSUP,GMTSEI,GMTSIV,GMTSEV,GMTSN,GMTSCHK,X,Y
86 K ^TMP($J,"GMTSLL"),^TMP($J,"GMTSLN"),^TMP($J,"GMTSTYP")
87 S GMTSUSR=+($G(GMTSUSR)) Q:GMTSUSR=0 Q:'$L($$UNM^GMTSXAW3(GMTSUSR))
88 S GMTSCPL=$G(GMTSCPL),GMTSPRE=$G(GMTSPRE)
89 S:'$L(GMTSCPL) GMTSCPL=0 S:'$L(GMTSPRE) GMTSPRE=$$DEF^GMTSXAW
90 S (GMTSPAR,X)="ORWRP HEALTH SUMMARY TYPE LIST"
91 S GMTSAD="GMTS HS ADHOC OPTION",GMTSAR="GMTS HS REMOTE ADHOC OPTION"
92 S GMTSYS=$$SYSV^GMTSXAW3,GMTSUP=$$UVP^GMTSXAW3(+GMTSUSR),GMTSPAR=+($$PDI^GMTSXAW3(GMTSPAR)) Q:GMTSPAR'>0 S GMTSENT="",U="^"
93 D CHK^GMTSXAW(.GMTSCHK,GMTSUSR,"GMTS")
94 F S GMTSENT=$O(^XTV(8989.5,"AC",GMTSPAR,GMTSENT)) Q:GMTSENT="" D BYE
95 K @ROOT D BUILD^GMTSXAB
96 K:'$D(GMTSIDX) @ROOT@("B"),@ROOT@("C") S (GMTSI,GMTSN)=0
97 F S GMTSI=$O(@ROOT@(GMTSI)) Q:+GMTSI=0 S GMTSN=GMTSN+1
98 S:+GMTSN>0 GMTSL=GMTSN
99 K ^TMP($J,"GMTSLL"),^TMP($J,"GMTSLN"),^TMP($J,"GMTSTYP")
100 Q
101BYE ; By Entity
102 Q:'$L(GMTSENT) Q:GMTSENT'[";" Q:+GMTSENT=0 Q:'$L($P(GMTSENT,";",2)) Q:'$D(GMTSCHK("CHK",GMTSENT))
103 S GMTSVAL=$P($G(@(U_$P(GMTSENT,";",2)_+($P(GMTSENT,";",1))_",0)")),U,1)
104 Q:'$L(GMTSVAL) K GMTSL,GMTSER Q:'$L($G(GMTSPAR)) Q:'$L($G(GMTSENT))
105 D GETLST^XPAR(.GMTSL,GMTSENT,GMTSPAR,"B",.GMTSER) Q:+($G(GMTSER))>0
106 S GMTSLI=0 F S GMTSLI=$O(GMTSL(GMTSLI)) Q:+GMTSLI=0 D BYP
107 Q
108BYP ; By Parameter
109 S GMTST=$$ABR^GMTSXAW3(GMTSENT) N GMTSII,GMTSEI,GMTSIV,GMTSEV,GMTSIEN,GMTSVAL,GMTSND,GMTSNM,GMTSHT
110 S GMTSII=$P($G(GMTSL(GMTSLI,"N")),"^",1) Q:'$L(GMTSII)
111 S GMTSEI=$P($G(GMTSL(GMTSLI,"N")),"^",2) Q:'$L(GMTSEI)
112 S GMTSIV=$P($G(GMTSL(GMTSLI,"V")),"^",1) Q:'$L(GMTSIV)
113 S GMTSEV=$P($G(GMTSL(GMTSLI,"V")),"^",2) Q:'$L(GMTSEV)
114 S GMTST=$S(GMTSPRE["NAT"&(+($G(^GMT(142,+GMTSIV,"VA")))>0):"NAT",1:$G(GMTST))
115 S GMTSND=$S(GMTSPRE["NAT"&(+($G(^GMT(142,+GMTSIV,"VA")))>0):"^TMP($J,""GMTSLN"")",1:"^TMP($J,""GMTSLL"")")
116 D SAV
117 Q
118SAV ; Save Parameters
119 N GMTSI Q:'$L($G(GMTSL(GMTSLI,"V"))) S GMTSVAL=GMTSL(GMTSLI,"V"),GMTSHT=+GMTSVAL,GMTSNM=$P(GMTSVAL,"^",2)
120 S GMTSI=(+($O(@GMTSND@(" "),-1)+1))
121 I GMTSNM=GMTSAD!(GMTSNM=GMTSAR) D SAVD Q
122 S @GMTSND@(GMTSI,"N")=$G(GMTSL(GMTSLI,"N"))
123 S @GMTSND@(GMTSI,"V")=$G(GMTSVAL)
124 S @GMTSND@(GMTSI,"E")=$G(GMTSENT)
125 S ^TMP($J,"GMTSTYP",GMTST,GMTSI)=$G(GMTSVAL)
126 S:$L(GMTSNM) ^TMP($J,"GMTSTYP",GMTST,"B",GMTSNM,GMTSI)=""
127 S:GMTSHT>0 ^TMP($J,"GMTSTYP",GMTST,"C",GMTSHT,GMTSI)=""
128 Q
129SAVD ; Save Adhoc and Remote Adhoc Parameters
130 N GMTSAT,GMTSC,GMTSI S GMTSND=$G(GMTSND) Q:'$L(GMTSND) Q:GMTSND="^TMP($J,""GMTSLN"")"
131 I GMTSNM=GMTSAD S GMTSI=(+($O(@GMTSND@("ADH"," "),-1)+1)),GMTSAT="ADH"
132 I GMTSNM=GMTSAR S GMTSI=(+($O(@GMTSND@("RAD"," "),-1)+1)),GMTSAT="RAD"
133 Q:'$L($G(GMTST)) Q:'$L($G(GMTSAT)) Q:'$L($G(GMTSNM)) Q:'$L($G(GMTSVAL)) Q:'$L($G(GMTSHT)) Q:$D(^TMP($J,"GMTSTYP",GMTST,GMTSAT,"B",GMTSNM))
134 S @GMTSND@("GMTSAT",GMTSI,"N")=$G(GMTSL(GMTSLI,"N"))
135 S @GMTSND@("GMTSAT",GMTSI,"V")=$G(GMTSL(GMTSLI,"V"))
136 S @GMTSND@("GMTSAT",GMTSI,"E")=$G(GMTSENT)
137 S @GMTSND@("GMTSAT","B",GMTSVAL,GMTSI)=""
138 S @GMTSND@("GMTSAT","C",GMTSEI_"^"_GMTSVAL,GMTSI)=""
139 S GMTSC=+($O(@GMTSND@("GMTST",GMTSAT," "),-1))+1
140 S ^TMP($J,"GMTSTYP",GMTST,GMTSAT,GMTSC)=$G(GMTSVAL)
141 S:$L(GMTSNM) ^TMP($J,"GMTSTYP",GMTST,GMTSAT,"B",GMTSNM,GMTSC)=""
142 S:GMTSHT>0 ^TMP($J,"GMTSTYP",GMTST,GMTSAT,"C",GMTSHT,GMTSC)=""
143 Q
144 ;
145 ; Miscellaneous
146NUM(X) ; Number of Types for User X
147 N GMTSUSR,GMTSL,GMTSI,GMTSN S GMTSUSR=+($G(X)),(GMTSI,GMTSN)=0 Q:GMTSUSR=0 0 Q:'$L($$UNM^GMTSXAW3(GMTSUSR)) 0
148 D GETLIST(.GMTSL,GMTSUSR) Q:+($G(GMTSL))>0 +($G(GMTSL))
149 F S GMTSI=$O(GMTSL(GMTSI)) Q:+GMTSI=0 S GMTSN=GMTSN+1
150 S X=GMTSN Q X
151DEF(X) ; Defaults <compile> ^ <precedence>
152 N DIERR,GMTSUSR,GMTSSIC,GMTSSIP,GMTSSCPL,GMTSPRE
153 S GMTSSIC=1,GMTSSIP=$$DEF^GMTSXAW
154 S GMTSUSR=+($G(X)),X=""
155 Q:+GMTSUSR=0 (GMTSSIC_"^"_GMTSSIP)
156 Q:'$L($$UNM^GMTSXAW3(+GMTSUSR)) (GMTSSIC_"^"_GMTSSIP)
157 S GMTSCPL=$$GET1^DIQ(142.98,(GMTSUSR_","),10,"I")
158 S:GMTSCPL="" GMTSCPL=GMTSSIC
159 S GMTSPRE=$$GET1^DIQ(142.98,(GMTSUSR_","),11)
160 S:GMTSPRE="" GMTSPRE=GMTSSIP
161 S X=GMTSCPL_"^"_GMTSPRE
162 Q X
163CPL(X) ; Compile Method
164 N DIERR,GMTSITE,GMTSUSR,GMTSCPL S GMTSUSR=+($G(X))
165 S GMTSITE=$P($G(^GMT(142.98,"ASITE")),"^",1)
166 S GMTSITE=$S($L(GMTSITE):+GMTSITE,1:1) I GMTSUSR=.5 S X=GMTSITE Q X
167 S GMTSCPL=$$GET1^DIQ(142.98,(GMTSUSR_","),10,"I")
168 S:'$L(GMTSCPL) GMTSCPL=GMTSITE
169 S X=GMTSCPL
170 Q X
171PRE(X) ; Precedence
172 N GMTSUSR,GMTSPRE,GMTSDEF,GMTSC,GMTSI,GMTSA,GMTS S GMTSUSR=+($G(X))
173 S (GMTSDEF,X)=$$DEF^GMTSXAW Q:+GMTSUSR=0 X S GMTSPRE=$$GET1^DIQ(142.98,(GMTSUSR_","),11),GMTSC="^"_$TR($$DEF^GMTSXAW,";","^")_"^"
174 S GMTS="" F GMTSI=1:1 Q:GMTSI>$L(GMTSPRE,";") D
175 . S GMTSA=$P($G(GMTSPRE),";",GMTSI) Q:$L(GMTSA)'=3 Q:GMTSA'="NAT"&(GMTSC'[("^"_GMTSA_"^")) Q:GMTS[(";"_GMTSA) S GMTS=GMTS_";"_GMTSA
176 S GMTSPRE=$$TRIM^GMTSXA(GMTS,";") S:'$L(GMTSPRE) GMTSPRE=GMTSDEF
177 S X=GMTSPRE
178 Q X
Note: See TracBrowser for help on using the repository browser.