source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSOBV.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
RevLine 
[613]1GMTSOBV ; SLC/KER - HS Object - Verify ; 01/06/2003
2 ;;2.7;Health Summary;**58**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10006 ^DIC (file #2 and 142.5)
6 ; DBIA 10013 ^DIK (file #142.5)
7 ; DBIA 10026 ^DIR
8 ; DBIA 10104 $$UP^XLFSTR
9 ; DBIA 10076 ^XUSEC(
10 ; DBIA 10076 ^XUSEC("GMTSMGR"
11 ; DBIA 3798 $$EXIST^TIUHSOBJ
12 ; DBIA 10005 DT^DICRW
13 ; DBIA 10103 $$DT^XLFDT
14 ; DBIA 10061 DEM^VADPT
15 ;
16 Q
17VT(X) ; Verify Type Selection
18 N GMTSHDR,GMTSNOQ,GMTSNOI,GMTSX,GMTSREDO S GMTSX=+($G(X)) Q:+GMTSX'>0 -1
19 S GMTSHDR(1)="You have selected the following Health Summary Type to use as an Object:"
20 S GMTSHDR(2)=" ",GMTSNOQ="",GMTSNOI="",GMTSREDO=0
21 D DT^GMTSOBD(+GMTSX) I $D(^TMP("GMTSOBT",$J)) D
22 . D NOQUE^GMTSOBD W ! N DIR,DTOUT,DUOUT S DIR(0)="YAO",DIR("A")="Is this correct? ",DIR("B")="Y"
23 . D ^DIR S:$$UP^XLFSTR($E(X,1))="N" GMTSREDO=1 I +Y'>0 S GMTSX=-1
24 I GMTSREDO>0!(GMTSX'>0) S X=-1
25 Q X
26VTE(X) ; Verify Type Edit
27 N GMTSX,GMTSOWN,GMTSNAT,GMTSLOCK,GMTSKEY,GMTSMGR S GMTSX=+($G(X)) Q:$D(GMTSDEV) X
28 I +GMTSX'>0 W:'$D(GMTSQT) !!," Health Summary Type not found.",! Q -1
29 I +($G(DUZ))'>0 W:'$D(GMTSQT) !!," User not defined.",! Q -1
30 I +($$UACT^GMTSU2(+($G(DUZ))))'>0 W:'$D(GMTSQT) !!," User is not an active user.",! Q -1
31 I '$D(^GMT(142,+GMTSX,0)) W:'$D(GMTSQT) !!," Health Summary Type not found.",! Q -1
32 I '$L($P($G(^GMT(142,+GMTSX,0)),"^",1)) W:'$D(GMTSQT) !!," Invalid Health Summary Type.",! Q -1
33 S GMTSMGR=$S($D(^XUSEC("GMTSMGR",+($G(DUZ)))):1,1:0),GMTSLOCK=$P($G(^GMT(142,+GMTSX,0)),"^",2)
34 S GMTSKEY=1 S:$L(GMTSLOCK) GMTSKEY=$D(^XUSEC(GMTSLOCK,+($G(DUZ))))
35 S GMTSOWN=$P($G(^GMT(142,+GMTSX,0)),"^",3),GMTSNAT=+($P($G(^GMT(142,+GMTSX,"VA")),"^",1))
36 I GMTSNAT>0 W:'$D(GMTSQT) !!," You can not edit a Nationally exported Health Summary Type.",! Q -1
37 I 'GMTSMGR,'GMTSKEY W:'$D(GMTSQT) !!," This Health Summary Type is currently locked to prevent alteration.",! Q -1
38 I GMTSOWN>0,GMTSOWN'=+($G(DUZ)) W:'$D(GMTSQT) !!," You can not edit a Health Summary Type you don't own.",! Q -1
39 S X=GMTSX Q X
40VOE(X) ; Verify Object Edit
41 N GMTSX,GMTSOWN,GMTSNAT,GMTSMGR S GMTSX=+($G(X)) Q:$D(GMTSDEV) X
42 I +GMTSX'>0 W:'$D(GMTSQT) !!," Health Summary Object not found.",! Q -1
43 I +($G(DUZ))'>0 W:'$D(GMTSQT) !!," User not defined.",! Q -1
44 I +($$UACT^GMTSU2(+($G(DUZ))))'>0 W:'$D(GMTSQT) !!," User is not an active user.",! Q -1
45 I '$D(^GMT(142.5,+GMTSX,0)) W:'$D(GMTSQT) !!," Health Summary Object not found.",! Q -1
46 I '$L($P($G(^GMT(142.5,+GMTSX,0)),"^",1)) W:'$D(GMTSQT) !!," Invalid Health Summary Object.",! Q -1
47 S GMTSMGR=$S($D(^XUSEC("GMTSMGR",+($G(DUZ)))):1,1:0)
48 S GMTSOWN=$P($G(^GMT(142.5,+GMTSX,0)),"^",17),GMTSNAT=+($P($G(^GMT(142,+GMTSX,"VA")),"^",1))
49 I GMTSNAT>0 W:'$D(GMTSQT) !!," You can not edit a Nationally exported Health Summary Object.",! Q -1
50 I GMTSOWN>0,GMTSOWN'=+($G(DUZ)) W:'$D(GMTSQT) !!," You can not edit a Health Summary Object you don't own.",! Q -1
51 S X=GMTSX Q X
52VO(X) ; Verify Object
53 N GMTSHDR,GMTSNOQ,GMTSNOI,GMTSX,GMTSREDO S GMTSREDO=0,GMTSX=+($G(X)) Q:+GMTSX'>0 -1
54 S GMTSHDR(1)="You have selected the following Health Summary Object:"
55 S GMTSHDR(2)=" " D SO^GMTSOBS(+GMTSX) W ! N DIR,DTOUT,DUOUT S DIR(0)="YAO",DIR("A")="Is this correct? ",DIR("B")="Y"
56 D ^DIR S:$$UP^XLFSTR($E(X,1))="N" GMTSREDO=1
57 S X=1 I GMTSREDO>0!(+Y'>0) S X=-1
58 Q X
59VOD(X) ; Verify Object Deletion
60 N GMTS,GMTSIEN,GMTSOWN,GMTSOK,GMTSI,GMTSN,GMTST,GMTSS,GMTSNAT,DIR,DTOUT,DIROUT,DUOUT,Y
61 S GMTSOK=0,GMTSIEN=+($G(X)) I +X'>0 D Q 0
62 . W !!," Sorry, you can not delete this Health Summary Object.",!
63 S GMTSN=$P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",1) I '$L(GMTSN) D Q 0
64 . W !!," Sorry, you can not delete this Health Summary Object."
65 . W !," There is a problem with the object's NAME field (#.01).",!
66 S GMTSNAT=$P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",20),GMTSOWN=$P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",17)
67 I +GMTSOWN>0,+GMTSOWN'=+($G(DUZ)) D Q 0
68 . W !!," You can not delete a Health Summary Object you don't own.",!
69 I +GMTSNAT>0,'$D(GMTSDEV) D Q 0
70 . W !!," You can not delete a Nationally Exported Health Summary Object.",!
71 S GMTST=" Object: "_GMTSN,GMTSS="",$P(GMTSS," ",(60-$L(GMTST))\2)=" ",GMTST=GMTSS_GMTST
72 I '$L($T(EXIST^TIUHSOBJ)) D Q 0
73 . W !!," Unable to determine if this Health Summary Object is linked"
74 . W !," to a TIU Object. Nothing deleted.",!
75 S X=$$EXIST^TIUHSOBJ(GMTSIEN) Q:+X'>0 1
76 S DIR("A",1)=" WARNING -- You are about to delete a Health Summary Object "
77 S DIR("A",2)=" currently in use by TIU. If you continue, then the associated"
78 S DIR("A",3)=" TIU Object will not display correctly."
79 S DIR("A",4)="",DIR("A",5)=GMTST,DIR("A",6)=""
80 S DIR("A")=" Are you sure you want to delete this Health Summary Object? "
81 S DIR(0)="YAO",DIR("B")="NO",(DIR("?"),DIR("??"))="^D VODH^GMTSOBV"
82 D ^DIR S X=$S(+Y>0:+GMTSX,1:0) S:$D(DTOUT)!($D(DUOUT)) X=0
83 Q X
84VODH ; VOD Help
85 W !," Enter either 'Y' or 'N'."
86 Q
87DEL(X) ; Verify Object Deletion
88 N GMTSIEN S GMTSIEN=+($G(X)) Q:GMTSIEN'>0 0 Q:'$L($P($G(^GMT(142.5,+GMTSIEN,0)),"^",1)) 0
89 Q:+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",17))&(+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",17))'=+($G(DUZ))) 0
90 Q:+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",20))&('$D(GMTSDEV)) 0
91 I $L($T(EXIST^TIUHSOBJ)),+($$EXIST^TIUHSOBJ(GMTSIEN))>0,'$D(GMTSDEV) Q 0
92 Q 1
93CRD(X) ; Create Delete
94 N GMTSIEN S GMTSIEN=+($G(X)) Q:GMTSIEN'>0 N DA,DIK,GMTSC,GMTSE,GMTSN,GMTST,GMTSR S GMTSN=$P($G(^GMT(142.5,+GMTSIEN,0)),"^",1)
95 S GMTSC=+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",17)) I +GMTSC>0,+GMTSC'=+($G(DUZ)) Q
96 S GMTSE=+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",20)) I GMTSE>0&('$D(GMTSDEV)) Q
97 I $L($T(EXIST^TIUHSOBJ)),+($$EXIST^TIUHSOBJ(GMTSIEN))>0 Q
98 S GMTSN=+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",1)),GMTST=+($P($G(^GMT(142.5,+($G(GMTSIEN)),0)),"^",3))
99 I $L(GMTSN),+($G(GMTST))>0,$D(^GMT(142,+($G(GMTST)),0)) Q
100 S DA=GMTSIEN,DIK="^GMT(142.5," D ^DIK
101 Q
102NAME(X) ; Verify Name for $$CRE^GMTSOBJ
103 N GMTSN,GMTSE S GMTSN=$G(X),GMTSE=$$EXIST(GMTSN) S:$L(GMTSN)<3!($L(GMTSN)>60) GMTSN=""
104 I $L(GMTSN)>2,$L(GMTSN)'>60,GMTSE'>0 Q X
105 N X,Y,DIR,DIROUT,DTOUT,DUOUT
106 S DIR(0)="FAO^3:60^N GMTS S GMTS=$$NIT^GMTSOBV(X) K:+GMTS'>0 X",GMTSN=""
107 S DIR("A")=" Health Summary Object Name: "
108 S (DIR("?"),DIR("??"))="^D NH^GMTSOBV"
109 D ^DIR S:$L(Y)>2&($L(Y)'>60) GMTSN=Y S X=GMTSN W !
110 Q X
111NIT(X) ; Name Input Transform
112 N GMTSN S GMTSN=$$EXIST($G(X)) Q:+GMTSN<0 0
113 I +GMTSN>0 D Q 0
114 . W !!," A Health Summary Object of the same name exist"
115 Q 1
116NH ; Name Help
117 W !," Enter a name of a new Health Summary Object, "
118 W !," 3 to 30 characters in length."
119 Q
120EXIST(X) ; Name Exist
121 ; Returns 0 Does not Exist
122 ; 1 Exist
123 ; -1 Error
124 N GMTSN,GMTSO,GMTSC,GMTSI,GMTSE,GMTST S GMTSN=$$UP^XLFSTR($G(X))
125 Q:$L(GMTSN)<3 -1 Q:$L(GMTSN)>60 -1
126 S GMTSE=0,GMTSO=$E(GMTSN,1,28),GMTSO=$E(GMTSO,1,($L(GMTSO)-1))_$C($A($E(GMTSO,$L(GMTSO)))-1)_"~",GMTSC=$E(GMTSO,1,($L(GMTSO)-2))
127 F S GMTSO=$O(^GMT(142.5,"C",GMTSO)) Q:GMTSO=""!(+GMTSE>0)!(GMTSO'[GMTSC) D
128 . S GMTSI=0 F S GMTSI=$O(^GMT(142.5,"C",GMTSO,GMTSI)) Q:+GMTSI=0 D
129 . . S GMTST=$$UP^XLFSTR($P($G(^GMT(142.5,GMTSI,0)),"^",1)) S:GMTSN=GMTST GMTSE=1
130 S X=GMTSE
131 Q X
132PAT ; Patient Lookup
133 K DFN,GMP D DT^DICRW N DIC,DTOUT,DUOUT,DIROUT,GMTSNAM,GMTSLAS,VA,VADM
134 S DIC=2,DIC("A")=" Select Patient: ",DIC(0)="AEQMZ",DT=$$DT^XLFDT,DTIME=300 D ^DIC I +Y>0 D
135 . S DFN=+Y N GMTSNAM,GMTSLAS,VA,VADM D DEM^VADPT S GMTSNAM=$G(VADM(1)),GMTSLAS=+($G(VA("BID")))
136 . S GMP=1,GMP(0)=1,GMP(1)=DFN_"^"_GMTSNAM_"^ "_GMTSNAM_" "_$S(+GMTSLAS>0:"(",1:0)_+GMTSLAS_$S(+GMTSLAS>0:")",1:0)_"^1"
137 Q
138LKO(X) ; Lookup Object
139 N DIC,DTOUT,DUOUT,DIROUT,DIR,GMTSX
140 S DIC="^GMT(142.5,",DIC("A")=" Select HEALTH SUMMARY OBJECT: ",U="^"
141 S DIC(0)="AEMQ" K DLAYGO D ^DIC S (X,GMTSX)=+Y Q:+Y'>0 -1 Q:$D(DTOUT)!($D(DUOUT)) -1
142 I +Y>0 D Q X
143 . N DIR,GMTSI,GMTSN S GMTSI=+Y,X=-1,GMTSN=$P($G(^GMT(142.5,+GMTSI,0)),"^",1) Q:'$L(GMTSN)
144 . S DIR(0)="YAO",DIR("A")=" Is this correct? ",DIR("B")="Y"
145 . W !!,"You have selected ",GMTSN,! D SO^GMTSOBS(GMTSX) W !
146 . D ^DIR S X=$S(+Y>0:+GMTSX,1:-1) S:$D(DTOUT)!($D(DUOUT)) X=-1
147 Q X
148TRIM(X) ; Trim Space Characters
149 S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
150 F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
151 Q X
Note: See TracBrowser for help on using the repository browser.