source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSOBU.m@ 619

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

initial load of WorldVistAEHR

File size: 7.1 KB
RevLine 
[613]1GMTSOBU ; SLC/KER - HS Object - Utility ; 01/06/2003
2 ;;2.7;Health Summary;**58**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10096 ^%ZOSF("DEL"
6 ; DBIA 10112 $$SITE^VASITE
7 ; DBIA 10104 $$UP^XLFSTR
8 ; DBIA 10026 ^DIR
9 ;
10 ; Errors
11ER1 ; Health Summary Object Exist
12 N GMTSTXT,GMTSLN S GMTSTXT="Can not install Health Summary Object '"_GMTSOBJ_"'. A Health Summary Object with the same name already exist." D WER S GMTSQIT=1 Q
13ER2 ; Health Summary Type Exist
14 N GMTSTXT,GMTSLN S GMTSTXT="Can not install Health Summary Type '"_GMTSTYP_"' for use by the Health Summary Object '"_GMTSOBJ_"'. A Health Summary Type with the same name already exist." D WER S GMTSQIT=1 Q
15ER3 ; Health Summary Title Exist
16 N GMTSTXT,GMTSLN S GMTSTXT="Can not install Health Summary Type '"_GMTSTYP_"' for use by the Health Summary Object '"_GMTSOBJ_"'. A Health Summary Type with the same TITLE ("_GMTSTTL_") already exist." D WER S GMTSQIT=1 Q
17WER ; Write Error
18 W !," Error:"
19WER2 ; Write Error Text
20 S GMTSLN=$$TRIM($E(GMTSTXT,1,65)),GMTSLN=$$TRIM($P(GMTSLN," ",1,($L(GMTSLN," ")-1))) S:$L(GMTSTXT)<65 GMTSLN=$$TRIM(GMTSTXT) W:$L(GMTSLN) !," ",GMTSLN
21 S GMTSTXT=$$TRIM($P(GMTSTXT,GMTSLN,2,299)),GMTSLN=$$TRIM($E(GMTSTXT,1,65)),GMTSLN=$$TRIM($P(GMTSLN," ",1,($L(GMTSLN," ")-1))) S:$L(GMTSTXT)<65 GMTSLN=$$TRIM(GMTSTXT) W:$L(GMTSLN) !," ",GMTSLN
22 S GMTSTXT=$$TRIM($P(GMTSTXT,GMTSLN,2,299)),GMTSLN=$$TRIM($E(GMTSTXT,1,65)),GMTSLN=$$TRIM($P(GMTSLN," ",1,($L(GMTSLN," ")-1))) S:$L(GMTSTXT)<65 GMTSLN=$$TRIM(GMTSTXT) W:$L(GMTSLN) !," ",GMTSLN
23 Q
24 ;
25EHST(X) ; Existing Health Summary Type
26 N GMTSRTN,GMTSEDAT,GMTSOBJ,GMTSTYP,GMTSTXT,GMTSLN,GMTS
27 N Y,DIR,DIROUT,DTOUT,DUOUT
28 S GMTSRTN="GMTSOBX",GMTSOBJ=$P($$TX(GMTSRTN,"OBJ",1),";",2),GMTSTYP=$P($$TX(GMTSRTN,"TYPE",1),";",2)
29 Q:'$L(GMTSOBJ)!('$L(GMTSTYP)) 0
30 W ! S GMTSTXT="Can not install Health Summary Type '"_GMTSTYP_"' to be used"
31 S GMTSTXT=GMTSTXT_" by the object. A Health Summary Type with the same name already exist." D WER2
32 S GMTSEDAT=$$NWX(GMTSTYP) Q:+($G(GMTSEDAT))'>0 0
33 S GMTSTXT="Do you want to use the pre-existing Health Summary Type '"_GMTSTYP_"' for this Object? (Y/N)"
34 S GMTSLN=$$TRIM($E(GMTSTXT,1,65))
35 S GMTSLN=$$TRIM($P(GMTSLN," ",1,($L(GMTSLN," ")-1)))
36 S:$L(GMTSTXT)<65 GMTSLN=$$TRIM(GMTSTXT) S:$L(GMTSLN) DIR("A",1)=" "_GMTSLN_" "
37 S GMTSTXT=$$TRIM($P(GMTSTXT,GMTSLN,2,299))
38 S GMTSLN=$$TRIM($E(GMTSTXT,1,65))
39 S GMTSLN=$$TRIM($P(GMTSLN," ",1,($L(GMTSLN," ")-1)))
40 S:$L(GMTSTXT)<65 GMTSLN=$$TRIM(GMTSTXT) S:$L(GMTSLN) DIR("A")=" "_GMTSLN_" "
41 S DIR("B")="N",DIR(0)="YAO",(DIR("?"),DIR("??"))="^D YNH^GMTSOBU" W ! D ^DIR
42 S GMTS=+($G(Y)) S X=0,GMTSQIT=1
43 ; Don't use the pre-existing HS
44 I +GMTS'>0 S GMTSQIT=1,GMTSEDAT=0 D Q X
45 . ; Rename HS
46 . D REN I $L($G(GMTSETYP)),$L($G(GMTSETTL)) S GMTSTYP=GMTSETYP,GMTSTTL=GMTSETTL,(GMTSEDAT,GMTSDAT)=$$TIEN
47 . S X=+GMTSEDAT S:+X>0 GMTSQIT=0
48 ; Use the pre-existing HS
49 I +GMTS>0,$L(GMTSTYP) S GMTSTE=1,(X,GMTSEDAT)=+($G(GMTSDAT)),GMTSQIT=0
50 Q X
51REN ; Rename Health Summary Type
52 N DIR,DIROUT,DUOUT,DTOUT,X,Y,GMTSNN,GMTSNT,GMTSNA S (GMTSETYP,GMTSETTL)=""
53 S DIR("A")=" Do you want to rename the imported Health Summary Type? (Y/N) "
54 S DIR("B")="Y",DIR(0)="YAO"
55 S (DIR("?"),DIR("??"))="^D YNH^GMTSOBU"
56 W ! D ^DIR Q:+Y=0
57 S GMTSETYP=$$EDN($G(GMTSTYP)) Q:'$L($G(GMTSETYP))
58 S GMTSETTL=$$EDT($G(GMTSTTL),$G(GMTSETYP)) S:'$L($G(GMTSETTL)) GMTSETYP=""
59 Q
60EDN(X) ; Edit Health Summary Type Name
61 N DIR,DIROUT,DUOUT,DTOUT,Y,GMTSNN,GMTSON,GMTSNA,GMTSETYP
62 S GMTSON=$G(X),GMTSETYP="" Q:'$L(GMTSON) ""
63 S DIR("A")=" Re-Name '"_GMTSON_"' to: "
64 S GMTSNN=GMTSON F S GMTSNN=$$TRIM($$NN(GMTSNN)) Q:+($$NWX(GMTSNN))=0
65 S:$L(GMTSNN) DIR("B")=GMTSNN
66 S DIR(0)="FAO^3:30^N GMTS S GMTS=$$CKN^GMTSOBU($G(X)) W:+GMTS=0&($L(X)) !!,"" '""_$G(X)_""' already exist."" K:+GMTS=0&($L(X)) X"
67 S (DIR("?"),DIR("??"))="^D LNH^GMTSOBU"
68 D ^DIR S X="" S:$L(Y)>2&($L(Y)<31) X=Y
69 Q X
70EDT(X,Y) ; Edit Health Summary Type Title
71 N DIR,DIROUT,DUOUT,DTOUT,GMTSNT,GMTSOT,GMTSTT,GMTSTY,GMTSNA,GMTSETYP
72 S GMTSOT=$G(X),GMTSTT=$$EN2^GMTSUMX($G(Y)),GMTSTY=$G(Y)
73 S GMTSNT=GMTSOT S:'$L(GMTSNT) GMTSNT=GMTSTT S GMTSNT=$$EN2^GMTSUMX(GMTSNT)
74 F S GMTSNT=$$TRIM($$NN(GMTSNT)) Q:+($$TWX(GMTSNT))=0
75 S DIR("A")=" Title: " S:$L(GMTSNT)>2&($L(GMTSNT)<31) DIR("B")=GMTSNT
76 S DIR(0)="FAO^3:30^N GMTS S GMTS=$$CKT^GMTSOBU($G(X)) W:+GMTS=0&($L(X)) !!,"" '""_$G(X)_""' already exist."" K:+GMTS=0&($L(X)) X"
77 S (DIR("?"),DIR("??"))="^D LNH^GMTSOBU"
78 D ^DIR S X="" S:$L(Y)>2&($L(Y)<31) X=Y
79 Q X
80YNH ; Yes No Help
81 W !," Enter either 'Y' or 'N'." Q
82LNH ; Length Help
83 W !," This response must have at least 3 characters and no more than 30"
84 W !," characters and must not contain embedded uparrow." Q
85CKN(X) ; Check New Name is Unique
86 S X=$$NWX($G(X)) S X=$S(+X>0:0,1:1) Q X
87CKT(X) ; Check New Title is Unique
88 S X=$$TWX($G(X)) S X=$S(+X>0:0,1:1) Q X
89 ;
90 ; Miscellaneous
91TIEN(X) ; Type IEN
92 N GMTSI,GMTSIEN S GMTSIEN=0 F GMTSI=5:1 D Q:+GMTSIEN>0
93 . Q:$G(^GMT(142,GMTSI,0))["GMTS HS ADHOC OPTION" I GMTSI>4999999 S GMTSI=5999999 Q
94 . S:'$D(^GMT(142,GMTSI)) GMTSIEN=GMTSI
95 S X=GMTSIEN Q X
96OIEN(X) ; Object IEN
97 N GMTSIEN,GMTSIT S GMTSIT=+($P($$SITE^VASITE,"^",3)) Q:+GMTSIT=0 -1
98 S GMTSIEN=+($O(^GMT(142.5,(GMTSIT_"9999")),-1))+1 Q:$D(^GMT(142.5,+GMTSIEN,0)) -1
99 S X=GMTSIEN
100 Q X
101BOX(X) ; Get HS Object IEN from B Index
102 N GMTSI,GMTSX,GMTSO,GMTSN S GMTSN=$G(X) Q:'$L(GMTSN) 0
103 S (GMTSI,GMTSO)=0 F S GMTSI=$O(^GMT(142.5,"B",$E(GMTSN,1,30),GMTSI)) Q:+GMTSI=0 D Q:GMTSO>0
104 . S GMTSX=$P($G(^GMT(142.5,+GMTSI,0)),"^",1) S:$$UP^XLFSTR(GMTSN)=$$UP^XLFSTR(GMTSX) GMTSO=GMTSI
105 S X=+($G(GMTSO))
106 Q X
107NWX(X) ; Get HS Name IEN from Word Index
108 N GMTSI,GMTSX,GMTST,GMTSN,GMTSW S GMTSN=$$UP^XLFSTR($G(X)) Q:'$L(GMTSN) 0
109 S GMTSW=$P(GMTSN," ",1),(GMTSI,GMTST)=0 F S GMTSI=$O(^GMT(142,"AW",GMTSW,GMTSI)) Q:+GMTSI=0 D Q:GMTST>0
110 . S GMTSX=$P($G(^GMT(142,+GMTSI,0)),"^",1) S:$$UP^XLFSTR(GMTSN)=$$UP^XLFSTR(GMTSX) GMTST=GMTSI
111 S X=+($G(GMTST))
112 Q X
113TWX(X) ; Get HS Title IEN from Word Index
114 N GMTSI,GMTSX,GMTST,GMTSN,GMTSW S GMTSN=$$UP^XLFSTR($G(X)) Q:'$L(GMTSN) 0
115 S GMTSW=$P(GMTSN," ",1),(GMTSI,GMTST)=0 F S GMTSI=$O(^GMT(142,"AW",GMTSW,GMTSI)) Q:+GMTSI=0 D Q:GMTST>0
116 . S GMTSX=$P($G(^GMT(142,+GMTSI,"T")),"^",1) S:$$UP^XLFSTR(GMTSN)=$$UP^XLFSTR(GMTSX) GMTST=GMTSI
117 S X=+($G(GMTST))
118 Q X
119NN(X) ; New Name
120 N GMTSNN,GMTSNI,GMTSNS
121 S GMTSNN=$G(X),GMTSNI=$P(GMTSNN," ",$L(GMTSNN," "))
122 S GMTSNS=$P(GMTSNN," ",1,($L(GMTSNN," ")-1))
123 S:+GMTSNI=0 GMTSNS=GMTSNN S:+GMTSNI=0 GMTSNI=1 S GMTSNI=+GMTSNI+1
124 S GMTSNS=$$TRIM(GMTSNS)
125 S:($L(GMTSNS)+$L(GMTSNI))>29 GMTSNS=$E(GMTSNS,1,30-($L(GMTSNI)+2))
126 S X=$$TRIM(GMTSNS)_" "_GMTSNI
127 Q X
128DEL(X) ; Delete Routine X
129 S X=$G(X) Q:'$L(X) Q:$L(X)>8 Q:$$ROK(X)=0 X ^%ZOSF("DEL") Q
130ROK(X) ; Routine Ok
131 S X=$G(X) Q:'$L(X) 0
132 N GMTSEX,GMTSTXT S GMTSEX="S GMTSTXT=$T(+1^"_X_")" X GMTSEX Q:'$L(GMTSTXT) 0 Q 1
133TX(R,T,L) ; Get Text (Routine/Tag/Line)
134 N GMTSEX,GMTSTXT S GMTSEX="S GMTSTXT=$T("_T_"+"_L_"^"_R_")" X GMTSEX S X=GMTSTXT
135 Q X
136TRIM(X) ; Trim Spaces
137 S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
138 F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
139 S X=$$UP^XLFSTR($E(X,1))_$E(X,2,$L(X))
140 Q X
Note: See TracBrowser for help on using the repository browser.