source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSXAP.m@ 1361

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

initial load of WorldVistAEHR

File size: 8.1 KB
Line 
1GMTSXAP ; SLC/KER - List Parameters/Precedence ; 02/27/2002
2 ;;2.7;Health Summary;**47,49**;Oct 20, 1995
3 Q
4 ;
5 ; External References in GMTSXAP
6 ; DBIA 2343 $$ACTIVE^XUSER
7 ; DBIA 10026 ^DIR
8 ;
9EN ; Main Entry Point for Health Summary
10 N GMTSUSR S GMTSUSR=+($G(DUZ)) D PREF Q
11EN2(X) ; Entry Point for User
12 N GMTSUSR S GMTSUSR=+($G(X)) D PREF Q
13 ;
14PREF ; Get Preference - Precedence
15 N GMTSACT Q:'$L($$UNM^GMTSXAW3(+($G(GMTSUSR))))
16 S GMTSACT=$$ACTIVE^XUSER(+GMTSUSR) D:+GMTSACT'>0 DP^GMTSXAP2(GMTSUSR)
17 Q:+GMTSACT'>0 S X=$$PRE(GMTSUSR) D:$L(X) EDIT^GMTSXAP2(GMTSUSR,X) Q
18 ;
19PRE(GMTSUSR) ; Precedence of Parameter Entities
20 ;
21 ; Input User, pointer to NEW PERSON file
22 ;
23 ; Output String of Selected Entity Abbreviations,
24 ; delimited by a semi-colon, and arranged in
25 ; the order they should be used.
26 ;
27 ; Example: USR;SYS;NAT
28 ;
29 ; Use "User" defined Health Summary Types,
30 ; "System" defined Health Summary Types and
31 ; "National" Health Summary Types in that order.
32 ;
33 N GMTSEL,GMTSORD,GMTS,GMTSDEF,GMTSEXIT,GMTSINC,GMTSIN,GMTSCPL,GMTSPRE
34 S GMTSUSR=+($G(GMTSUSR)),GMTSEXIT=0 Q:'$L($$UNM^GMTSXAW3(+($G(GMTSUSR)))) ""
35 W:+($G(GMTSUSR))'=.5 !,"CPRS Reports Tab, Health Summary Type List (Contents)",!
36 W:+($G(GMTSUSR))=.5 !,"Site Default CPRS Reports Tab, Health Summary Type List (Contents)",!
37 D INA S GMTSIN=0 F S GMTSIN=$O(GMTSINC(GMTSIN)) Q:+GMTSIN=0 Q:+($G(GMTSEXIT))>0 D INC(GMTSINC(GMTSIN)) Q:+($G(GMTSEXIT))>0
38 I +GMTSEXIT>0,$D(GMTSEL("@")) D ADEL^GMTSXAP2
39 Q:+($G(GMTSEXIT))>0 "" S X="" I '$D(GMTSEL)!($O(GMTSEL(0))'>0) Q X
40 I $D(GMTSEL),$O(GMTSEL(0))>0 D ORD
41 I +GMTSEXIT>0,$D(GMTSORD("@")) D ADEL^GMTSXAP2
42 S:+($G(GMTSEXIT))=0 X=$$CPL
43 I +GMTSEXIT>0,$D(GMTSCPL("@")) D ADEL^GMTSXAP2
44 Q X
45 ; Include Health Summary Types
46INA ; Input Array (from Parameter File)
47 N GMTSI,GMTST,GMTSA,GMTSN,GMTSP,GMTSH,GMTSC,GMTSALW D EN^GMTSXAW
48 S (GMTSC,GMTSI)=0 F S GMTSI=$O(GMTSALW(GMTSI)) Q:+GMTSI=0 D
49 . S GMTST=$G(GMTSALW(GMTSI)) Q:'$L(GMTST) S GMTSA=$P(GMTST,"^",1) Q:$L(GMTSA)'=3 S GMTSN=$P(GMTST,"^",4) Q:'$L(GMTSN)
50 . ; Include User Preferred Health Summary Types: (Y/N)
51 . ; Include System Defined Health Summary Types: (Y/N)
52 . ; Group National Types together (Remote Data Views): (Y/N)
53 . S GMTSP="Include "_GMTSN_" Defined Health Summary Types"
54 . S GMTSH=GMTSN_" Level Health Summary Types"
55 . S:GMTSA="USR" GMTSP="Include "_GMTSN_" Preferred Health Summary Types",GMTSH=GMTSN_" Preferred Health Summary Types"
56 . S GMTSC=GMTSC+1,GMTSINC(GMTSC)=GMTSA_"^"_GMTSP_"^"_GMTSH
57 S GMTSC=GMTSC+1,GMTSA="NAT",GMTSN="National"
58 S GMTSP="Group "_GMTSN_" Types together (Remote Data View)"
59 S GMTSH="Nationally Exported Health Summary Types"
60 S GMTSINC(GMTSC)=GMTSA_"^"_GMTSP_"^"_GMTSH
61 Q
62INC(X) ; Select Health Summary Types to Include
63 Q:+($G(GMTSEXIT))>0 N Y,DIR,%,%P,DTOUT,DUOUT,DIRUT,DIROUT,GMTSI,GMTST,GMTSA,GMTSO S GMTST=$G(X)
64 S GMTSA=$P(GMTST,"^",1),GMTSO=$P(GMTST,"^",3),GMTST=$P(GMTST,"^",2) Q:'$L(GMTST) Q:GMTSA'?3U
65 S GMTSI=+($O(GMTSDEF(" "),-1))+1,GMTSDEF(GMTSI)=GMTSA_"^"_GMTST_"^"_GMTSO
66 S DIR(0)="YAO",DIR("A")=" "_GMTST_":" F Q:$L(DIR("A"))>51 S DIR("A")=DIR("A")_" "
67 S DIR("A")=DIR("A")_" (Y/N) " S:$L(GMTSO) DIR("A")=" "_DIR("A")
68 S DIR("B")="Y",DIR("?")="^D INH1^GMTSXAP",DIR("??")="^D INH2^GMTSXAP"
69 S:DIR("A")["Group Nat" DIR("B")="N"
70 D ^DIR I Y="",X="@" D
71 . N GMTSD S GMTSD=$P($G(^GMT(142.98,+($G(GMTSUSR)),1)),"^",2)
72 . S GMTSEXIT="1^"_$S($L(GMTSD):"",1:"exiting")
73 . S Y="@" K GMTSEL S GMTSEL("@")=""
74 S:Y["^"!($D(DUOUT))!($D(DIROUT)) GMTSEXIT="1^exiting"
75 S:$D(DTOUT) GMTSEXIT="1^try later"
76 I +($G(GMTSEXIT))>0 W $S($L($P(GMTSEXIT,"^",2)):"...",1:""),$P(GMTSEXIT,"^",2) Q
77 I +Y>0 S GMTSI=+($O(GMTSEL(" "),-1))+1,GMTSEL(GMTSI)=GMTSA_"^"_GMTST_"^"_GMTSO
78 Q
79INH1 ; Include Help - Single ?
80 W !," Enter either 'Y' or 'N'" D INH3 Q
81INH2 ; Include Help - Double ??
82 W !," Select specified groups of Health Summary Types to include in the"
83 W !," Health Summary Types list on the CPRS Reports Tab. Groups include:",!
84 W !," USR User Preferred Health Summary Types in the Parameters file"
85 W !," SYS System Defined Summary Types in the parameters file"
86 W !," NAT National Health Summary Types (Remote Data Views)" D INH3 Q
87INH3 ; Include Help - Prompt
88 I $L($G(DIR("A"))),$G(DIR("A"))'["Include",$G(DIR("A"))=$G(%P) D
89 . N GMTSL S GMTSL=" ",GMTSL=$S($G(DIR("A"))[GMTSL:" ",1:"")
90 . S (%P,DIR("A"))=GMTSL_" Include "_$$TRIM^GMTSXA(DIR("A")," ",1)
91 Q
92 ;
93ORD ; Order of Health Summaries in List
94 N GMTSI,GMTST,GMTSC,GMTSCNT,GMTSTOT,GMTSREM,GMTSSO,GMTSNXT,GMTSNXC
95 S (GMTSSO,GMTSCNT,GMTSI)=0,(GMTSTOT,GMTST)=$$SLT^GMTSXAP2
96 ; One Selected
97 I GMTST=1 D Q
98 . S (GMTSI,GMTSC)=0 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
99 . . S GMTST=$P($G(GMTSEL(GMTSI)),"^",1)
100 . . S:GMTST?3U GMTSC=GMTSC+1,GMTSORD(GMTSC)=GMTSEL(GMTSI)
101 ; Multiple Selected
102 W !!!," You have selected multiple Health Summary types to be listed on the CPRS",!," reports tab. Now you must select the order in which you want these to",!," be displayed."
103 F Q:+($G(GMTSEXIT))>0 D SO Q:+($G(GMTSEXIT))>0 Q:'$D(GMTSEL)
104 Q
105SO ; Select Order
106 N GMTSI,GMTSC,GMTSMAX,GMTSREO S GMTSI=0,GMTSREM=$$SLT^GMTSXAP2
107 S GMTSCNT=GMTSTOT-GMTSREM,GMTSNXT=GMTSCNT+1,GMTSSO=+($G(GMTSSO))+1
108 S GMTSNXC=$S(GMTSNXT=1:(GMTSNXT_"st"),GMTSNXT=2:(GMTSNXT_"nd"),GMTSNXT=3:(GMTSNXT_"rd"),1:(GMTSNXT_"th"))
109 I +GMTSREM=1 D Q
110 . S Y=+GMTSREM D SET
111 W ! D:+($G(GMTSSO))=1 SOHD D SOL,REO S (GMTSC,GMTSI)=0
112 S GMTSMAX=GMTSREM
113 W ! N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
114 S DIR(0)="NAO^1:"_GMTSMAX_":0"
115 S DIR("?")="^D SOH1^GMTSXAP"
116 S DIR("??")="^D SOH2^GMTSXAP"
117 S DIR("A")=" Select the "_GMTSNXC_" to be listed: "
118 K DIR("B") S:+($O(GMTSREO(0)))>0 DIR("B")=+($O(GMTSREO(0)))
119 D ^DIR I Y="",X="@" D
120 . N GMTSD S GMTSD=$P($G(^GMT(142.98,+($G(GMTSUSR)),1)),"^",2)
121 . S GMTSEXIT="1^"_$S($L(GMTSD):"",1:"exiting")
122 . S Y="@" K GMTSORD S GMTSORD("@")=""
123 S:Y["^"!($D(DUOUT))!($D(DIROUT)) GMTSEXIT="1^exiting" S:$D(DTOUT) GMTSEXIT="1^try later"
124 I +($G(GMTSEXIT))>0 W $S($L($P(GMTSEXIT,"^",2)):"...",1:""),$P(GMTSEXIT,"^",2) Q
125 I +Y>0,+Y'>GMTSREM D SET
126 Q
127SOL ; List - Included Health Summaries
128 N GMTSC,GMTSI S (GMTSC,GMTSI)=0 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
129 . S GMTSC=GMTSC+1 W !,?9,$J(GMTSC,4)," ",$P(GMTSEL(GMTSI),"^",3)
130 Q
131SOHD ; Help Text
132 W !," Order to Display Included Health Summary Types",! Q
133SOH1 ; Help - Single ?
134 N GMTSC,GMTSI,GMTSN,GMTSCT S (GMTSC,GMTSI)=0,GMTSCT=+($G(GMTSNXT)) F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 S GMTSC=GMTSC+1
135 S GMTSN=$S(GMTSCT=1:"first",GMTSCT=2:"second",GMTSCT=3:"third",GMTSCT=4:"fourth",GMTSCT=5:"fifty",GMTSCT=6:"sixth",GMTSCT=7:"seventh",GMTSCT=8:"eighth",GMTSCT=9:"nineth",1:"")
136 I '$L(GMTSN),+GMTSC>1 W !,?9,"Select a group of Health Summary Types to list (1-",GMTSC,")",!
137 I $L(GMTSN),+GMTSC>1 W !,?9,"Select a group of Health Summary Types to list ",GMTSN," (1-",GMTSC,")",!
138 D SOL
139 Q
140SOH2 ; Help - Double ??
141 W !," You have included multiple Health Summary types to be"
142 W !," listed on the CPRS reports tab, Health Summary Types box."
143 W !," Now you must select the order in which you want these"
144 W !," to be listed.",!
145 D SOL
146 Q
147 ;
148 ; Arrange
149SET ; Set Order
150 D REO N GMTSO S GMTSO=+($O(GMTSORD(" "),-1))+1
151 S:$L($G(GMTSREO(+$G(Y)))) GMTSORD(GMTSO)=$G(GMTSREO(+Y))
152 S (GMTSC,GMTSI)=0
153 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
154 . S GMTSC=GMTSC+1 I GMTSC=+Y K GMTSEL(GMTSI),GMTSREO(GMTSC)
155 Q
156REO ; Re-order
157 K GMTSREO N GMTSC,GMTSI S (GMTSC,GMTSI)=0
158 F S GMTSI=$O(GMTSEL(GMTSI)) Q:+GMTSI=0 D
159 . S GMTSC=GMTSC+1 S GMTSREO(GMTSC)=$G(GMTSEL(GMTSI))
160 Q
161CPL(X) ; Compile Order
162 Q:+($G(GMTSEXIT))>0 ""
163 N GMTSI,GMTSA,GMTSOK,GMTSNEW S X="",GMTSI=0
164 F S GMTSI=$O(GMTSORD(GMTSI)) Q:+GMTSI=0 D
165 . S GMTSA=$$UP^GMTSXA($P($G(GMTSORD(GMTSI)),"^",1))
166 . S:GMTSA?3U X=$G(X)_";"_GMTSA
167 S (GMTSNEW,X)=$$TRIM^GMTSXA(X,";",3)
168 S GMTSOK=$$OK^GMTSXAP2 Q:GMTSOK'>0 ""
169 Q X
Note: See TracBrowser for help on using the repository browser.