source: WorldVistAEHR/trunk/r/GEN_MED_OTHER-GMV/GMVUID.m@ 1650

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

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1GMVUID ;HIOFO/FT-VUID-RELATED UTILITIES ;5/3/05 11:48
2 ;;5.0;GEN. MED. REC. - VITALS;**8**;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #2263 - XPAR calls (supported)
6 ; #4631 - XTID calls (supported)
7 ; #10070 - ^XMD (supported)
8 ; #4640 - ^HDISVF01 (supported)
9 ;
10EN(ERROR) ; Clean up existing file connections and gui templates
11 ;
12 I ERROR D QMAIL Q
13 N FILE,OK
14 S OK=1
15 F FILE=120.51,120.52,120.53 I '$$SCREEN^HDISVF01(FILE) S OK=0
16 Q:'OK
17 D QUAL,CAT,TEMPS
18 Q
19QMAIL ; Queue mail message
20 N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
21 S ZTRTN="MAIL^GMVUID",ZTDESC="GMRV VITALS VUID ERROR"
22 S ZTIO="",ZTDTH=$H
23 D ^%ZTLOAD
24 Q
25MAIL ; Send mail message to installer that an error occurred
26 N GMVMSG,XMDUZ,XMSUB,XMTEXT,XMY
27 S XMY(DUZ)=""
28 S XMDUZ=.5 ;message sender
29 S XMSUB="ERROR IN VITALS VUID UPDATE"
30 S GMVMSG(1)="An error occurred while updating the VUID data for the"
31 S GMVMSG(2)="GEN. MED. REC. - VITALS package files. "
32 S GMVMSG(3)=" "
33 S GMVMSG(4)="Please log a Remedy ticket immediately. "
34 S XMTEXT="GMVMSG("
35 D ^XMD
36 Q
37QUAL ; Loop through the Qualifier entries in FILE 120.52:
38 ; 1) If the QUALIFIER is not active, get rid of all VITAL TYPE (#1)
39 ; associations,
40 ; 2) If the QUALIFIER is active and a VITAL TYPE is not active, get rid
41 ; of that VITAL TYPE association,
42 ; 3) If the QUALIFIER and VITAL TYPE are active, but the CATEGORY
43 ; (#.02 in subfile 120.521) is not, get rid of that subfile entry.
44 ;
45 N GMVNODE,GMVQUAL,GMVT
46 S GMVQUAL=0
47 F S GMVQUAL=$O(^GMRD(120.52,GMVQUAL)) Q:'GMVQUAL D
48 .I $$ACTIVE(120.52,"",GMVQUAL_",","") D Q ;see #1 above
49 ..S GMVT=0
50 ..F S GMVT=$O(^GMRD(120.52,GMVQUAL,1,GMVT)) Q:'GMVT D
51 ...D QUAL1(GMVQUAL,GMVT)
52 ...Q
53 ..Q
54 .S GMVT=0
55 .F S GMVT=$O(^GMRD(120.52,GMVQUAL,1,GMVT)) Q:'GMVT D
56 ..S GMVNODE=$G(^GMRD(120.52,GMVQUAL,1,GMVT,0))
57 ..S GMVTY=$$ACTIVE(120.51,"",+$P(GMVNODE,U)_",","")
58 ..I GMVTY D
59 ...D QUAL1(GMVQUAL,GMVT)
60 ...Q
61 ..I 'GMVTY D
62 ...S GMVNODE=$G(^GMRD(120.52,GMVQUAL,1,GMVT,0))
63 ...Q:GMVNODE=""
64 ...I $$ACTIVE(120.53,"",$P(GMVNODE,U,2)_",","") D
65 ....D QUAL1(GMVQUAL,GMVT)
66 ....Q
67 ...Q
68 ..Q
69 .Q
70 Q
71QUAL1(GMVX,GMVY) ; Delete a multiple entry (#1) in FILE 120.52
72 N DA,DIK
73 S DA(1)=GMVX,DA=GMVY,DIK="^GMRD(120.52,"_DA(1)_",1,"
74 D ^DIK
75 Q
76CAT ; Loop through the Category entries in FILE 120.53:
77 ; 1) If the CATEGORY is not active, get rid of all VITAL TYPE (#1)
78 ; associations,
79 ; 2) If the CATEGORY is active and a VITAL TYPE is not active, get rid
80 ; of that VITAL TYPE association,
81 ; 3) If the CATEGORY and VITAL TYPE are active, but the DEFAULT
82 ; QUALIFIER (#.07) is not, null out the DEFAULT QUALIFIER field.
83 ;
84 N GMVCAT,GMVNODE,GMVT,GMVTI,GMVTY
85 S GMVCAT=0
86 F S GMVCAT=$O(^GMRD(120.53,GMVCAT)) Q:'GMVCAT D
87 .I $$ACTIVE(120.53,"",GMVCAT_",","") D Q ;see #1 sbove
88 ..S GMVT=0
89 ..F S GMVT=$O(^GMRD(120.53,GMVCAT,1,GMVT)) Q:'GMVT D
90 ..D CAT1(GMVCAT,GMVT)
91 ..Q
92 .;The CATEGORY is active, but check if the VITAL TYPE is active.
93 .S GMVT=0
94 .F S GMVT=$O(^GMRD(120.53,GMVCAT,1,GMVT)) Q:'GMVT D
95 ..S GMVTI=+$P($G(^GMRD(120.53,GMVCAT,1,GMVT,0)),U,1)
96 ..S GMVTY=$$ACTIVE(120.51,"",GMVTI_",","")
97 ..I GMVTY D ;see #2 above
98 ...D CAT1(GMVCAT,GMVT)
99 ...Q
100 ..I 'GMVTY D
101 ...S GMVNODE=$G(^GMRD(120.53,GMVCAT,1,GMVT,0))
102 ...Q:GMVNODE=""
103 ...Q:$P(GMVNODE,U,7)=""
104 ...I $$ACTIVE(120.52,"",$P(GMVNODE,U,7)_",","") D ;see #3 above
105 ....D CAT2(GMVCAT,GMVT)
106 ....Q
107 ...Q
108 ..Q
109 .Q
110 Q
111CAT1(GMVX,GMVY) ; Delete a multiple entry (#1) in FILE 120.53
112 N DA,DIK
113 S DA(1)=GMVX,DA=GMVY,DIK="^GMRD(120.53,"_DA(1)_",1,"
114 D ^DIK
115 Q
116CAT2(GMVX,GMVY) ; Delete a default qualifier
117 Q:'GMVX
118 Q:'GMVY
119 S $P(^GMRD(120.53,GMVX,1,GMVY,0),U,7)=""
120 Q
121ACTIVE(GMVFILE,GMVFLD,GMVIEN,GMVDATE) ; Calls the $$SCREEN^XTID API to get VUID status
122 ; Input: GMVFILE - File number
123 ; GMVFLD - Field number
124 ; GMVIEN - IEN
125 ; GMVDATE - Date
126 ; Output: 0 - Active
127 ; 1 - Inactive
128 Q $$SCREEN^XTID(GMVFILE,GMVFLD,GMVIEN,GMVDATE)
129 ;
130GET(GMVFILE,GMVIEN,GMVREF) ; Calls the $$GETVUID^XTID API to get the VUID number
131 ; GMVFILE - File number
132 ; GMVIEN - field #
133 ; GMVREF - value
134 N GMVUID
135 S GMVUID=$$GETVUID^XTID(GMVFILE,GMVIEN,GMVREF)
136 Q $P(GMVUID,U,1)
137 ;
138TEMPS ; Clean up GUI templates definitions.
139 ; If a qualifier is inactive, remove it and its category.
140 N GMV,GMV1,GMV2,GMVDESC,GMVERR,GMVI,GMVJ,GMVLIST,GMVNEW,GMVNODE,GMVOLD,GMVORIG,GMVQUAL,GMVX,GMVY
141 K ^TMP($J)
142 S GMVLIST=$NA(^TMP($J))
143 D ENVAL^XPAR(.GMVLIST,"GMV TEMPLATE","","",1)
144 Q:'$D(^TMP($J))
145 S GMV1="" ; ien;file
146 F S GMV1=$O(^TMP($J,GMV1)) Q:GMV1="" D
147 .S GMV2="" ;template name
148 .F S GMV2=$O(^TMP($J,GMV1,GMV2)) Q:GMV2="" D
149 ..S (GMVNODE,GMVORIG)=$G(^TMP($J,GMV1,GMV2))
150 ..Q:GMVNODE=""
151 ..S GMVDESC=$P(GMVNODE,"|",1) ;template description
152 ..S GMVNODE=$P(GMVNODE,"|",2)
153 ..K GMV ;array of vital types
154 ..F GMVI=1:1 Q:$P(GMVNODE,";",GMVI)="" S GMV(GMVI)=$P(GMVNODE,";",GMVI)
155 ..S GMVI=0
156 ..F S GMVI=$O(GMV(GMVI)) Q:'GMVI D
157 ...S GMVX=GMV(GMVI)
158 ...Q:GMVX=""
159 ...S GMVY=$P(GMVX,":",1,2) ;vital ien:metric indicator
160 ...S GMVX=$P(GMVX,":",3) ;~categories,qualifiers~
161 ...Q:GMVX=""
162 ...S GMVNEW=""
163 ...F GMVJ=1:1 Q:$P(GMVX,"~",GMVJ)="" D
164 ....S GMVOLD=$P(GMVX,"~",GMVJ) ;each category & qualifier combo
165 ....S GMVQUAL=$P(GMVOLD,",",2) ;qualifier
166 ....I '$$ACTIVE(120.52,"",GMVQUAL_",",""),$$COMBO($P(GMVY,":",1),GMVQUAL,$P(GMVOLD,",",1)) S GMVNEW=GMVNEW_GMVOLD_"~" ;active qualifier & right combination of type, qualifier and category
167 ...I $E(GMVNEW,$L(GMVNEW))="~" S GMVNEW=$E(GMVNEW,1,($L(GMVNEW)-1))
168 ...S:GMVNEW]"" GMVNEW=GMVY_":"_GMVNEW
169 ...S:GMVNEW="" GMVNEW=GMVY
170 ...S GMV(GMVI)=GMVNEW
171 ..S GMVI=0,GMVNODE=GMVDESC_"|"
172 ..F S GMVI=$O(GMV(GMVI)) Q:'GMVI D
173 ...S GMVNODE=GMVNODE_GMV(GMVI)_";"
174 ...Q
175 ..I $E(GMVNODE,$L(GMVNODE))=";" S GMVNODE=$E(GMVNODE,1,($L(GMVNODE)-1))
176 ..I $E(GMVNODE,$L(GMVNODE))="|" S GMVNODE=$E(GMVNODE,1,($L(GMVNODE)-1))
177 ..I GMVNODE=GMVORIG Q ;no change in template
178 ..D EN^XPAR(GMV1,"GMV TEMPLATE",GMV2,GMVNODE,.GMVERR)
179 ..Q
180 .Q
181 K ^TMP($J)
182 Q
183COMBO(GMVTI,GMVQUALI,GMVCATI) ; Check if this combination is in the AA cross-
184 ; reference of File 120.52
185 ; Input:
186 ; GMVTI - File 120.51 ien
187 ; GMVQUALI - File 120.52 ien
188 ; GMVCATI - File 120.53 ien
189 N GMVFLAG,GMVQUALE
190 S GMVFLAG=0
191 S GMVTI=+$G(GMVTI),GMVQUALI=+$G(GMVQUALI),GMVCATI=+$G(GMVCATI)
192 I 'GMVTI!(GMVQUALI'>0)!(GMVCATI'>0) Q GMVFLAG
193 S GMVQUALE=$P($G(^GMRD(120.52,GMVQUALI,0)),U,1)
194 I GMVQUALE="" Q GMVFLAG
195 I $D(^GMRD(120.52,"AA",GMVTI,GMVCATI,GMVQUALE,GMVQUALI)) S GMVFLAG=1
196 Q GMVFLAG
197 ;
Note: See TracBrowser for help on using the repository browser.