source: FOIAVistA/trunk/r/GEN_MED_OTHER-GMV/GMVDCRPC.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 8.3 KB
Line 
1GMVDCRPC ;HOIFO/DAD-VITALS COMPONENT: RPCs ;8/24/99 08:28
2 ;;5.0;GEN. MED. REC. - VITALS;;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; <None>
6 ;
7EN1(RESULT,GMVFMT,GMVITTYP) ;
8 ; RPC: GMVDC GET VITAL CATEGORIES
9 ; Get list of the categories
10 ; Input:
11 ; GMVFMT = Format of returned data (Optional)
12 ; 1 - IENs (default), 2 - Abbreviations, 3 - Full Names
13 ; GMVITTYP = A pointer to GMRV Vital Type file (#120.51) (Optional)
14 ; Output:
15 ; RESULT() = CategoryIEN ^ CategoryName ^
16 ; VitalTypeIEN ^ DefaultQualifier
17 N GMVCNT,GMVD0,GMVD1,GMVDATA,GMVDEFQ
18 S GMVCNT=0
19 S GMVFMT=$S("^1^2^3^"[(U_$G(GMVFMT)_U):GMVFMT,1:1)
20 I $G(GMVITTYP)="" D
21 . S GMVITTYP=0
22 . F S GMVITTYP=$O(^GMRD(120.53,"C",GMVITTYP)) Q:GMVITTYP'>0 D EN1A
23 . Q
24 E D
25 . S GMVITTYP=$$VITIEN^GMVDCUTL(GMVITTYP)
26 . D EN1A
27 . Q
28 S RESULT(0)="OK"
29 Q
30EN1A S GMVD0=0
31 F S GMVD0=$O(^GMRD(120.53,"C",GMVITTYP,GMVD0)) Q:GMVD0'>0 D
32 . S GMVD1=0
33 . F S GMVD1=$O(^GMRD(120.53,"C",GMVITTYP,GMVD0,GMVD1)) Q:GMVD1'>0 D
34 .. S GMVDATA=$P($G(^GMRD(120.53,GMVD0,0)),U)
35 .. I GMVDATA]"" D
36 ... S GMVITTYP(0)=$G(^GMRD(120.51,+GMVITTYP,0))
37 ... S GMVITTYP(1)=GMVITTYP,GMVITTYP(2)=$P(GMVITTYP(0),U,2)
38 ... S GMVITTYP(3)=$P(GMVITTYP(0),U)
39 ... S GMVDEFQ=$P($G(^GMRD(120.53,GMVD0,1,GMVD1,0)),U,7)
40 ... S GMVDEFQ(0)=$G(^GMRD(120.52,+GMVDEFQ,0))
41 ... S GMVDEFQ(1)=GMVDEFQ,GMVDEFQ(2)=$P(GMVDEFQ(0),U,2)
42 ... S GMVDEFQ(3)=$P(GMVDEFQ(0),U)
43 ... S GMVCNT=GMVCNT+1
44 ... S RESULT(GMVCNT)=GMVD0_U_GMVDATA_U_GMVITTYP(GMVFMT)_U_GMVDEFQ(GMVFMT)
45 ... Q
46 .. Q
47 . Q
48 Q
49 ;
50EN2(RESULT) ;
51 ; RPC: GMVDC GET VITAL ERROR REASONS
52 ; Get list of the entered in error reasons
53 ; Input:
54 ; None
55 ; Output:
56 ; RESULT() = ErrorReasonInternal ^ ErrorReasonExternal
57 N GMVD0,GMVDATA
58 S GMVDATA=$$GET1^DID(120.506,.01,"","POINTER")
59 F GMVD0=1:1 S GMVDATA(0)=$P(GMVDATA,";",GMVD0) Q:GMVDATA(0)="" D
60 . S RESULT(GMVD0)=$TR(GMVDATA(0),":","^")
61 . Q
62 S RESULT(0)="OK"
63 Q
64 ;
65EN3(RESULT,GMVFMT,GMVITTYP,GMVITCAT) ;
66 ; RPC: GMVDC GET VITAL QUALIFIERS
67 ; Get list of the qualifiers
68 ; Input:
69 ; GMVFMT = Format of returned data (Optional)
70 ; 1 - IENs (default), 2 - Abbreviations, 3 - Full Names
71 ; GMVITTYP = A pointer to GMRV Vital Type file (#120.51) (Optional)
72 ; GMVITCAT = A pointer to GMRV Vital Category file (#120.53) (Optional)
73 ; Output:
74 ; RESULT() = QualifierIEN ^ QualifierName ^ QualifierSynonym ^
75 ; VitalTypeIEN ^ CategoryIEN
76 N GMVCATD0,GMVCNT,GMVD0,GMVD1,GMVDATA
77 S GMVCNT=0
78 S GMVFMT=$S("^1^2^3^"[(U_$G(GMVFMT)_U):GMVFMT,1:1)
79 S GMVITCAT=$$CATIEN^GMVDCUTL($G(GMVITCAT))
80 I $G(GMVITTYP)="" D
81 . S GMVITTYP=0
82 . F S GMVITTYP=$O(^GMRD(120.52,"C",GMVITTYP)) Q:GMVITTYP'>0 D EN3A
83 . Q
84 E D
85 . S GMVITTYP=$$VITIEN^GMVDCUTL(GMVITTYP)
86 . D EN3A
87 . Q
88 S RESULT(0)="OK"
89 Q
90EN3A S GMVD0=0
91 F S GMVD0=$O(^GMRD(120.52,"C",GMVITTYP,GMVD0)) Q:GMVD0'>0 D
92 . S GMVD1=0
93 . F S GMVD1=$O(^GMRD(120.52,"C",GMVITTYP,GMVD0,GMVD1)) Q:GMVD1'>0 D
94 .. S GMVCATD0=$P($G(^GMRD(120.52,GMVD0,1,GMVD1,0)),U,2)
95 .. I $G(GMVITCAT)>0,GMVITCAT'=GMVCATD0 Q
96 .. S GMVDATA=$G(^GMRD(120.52,GMVD0,0))
97 .. I GMVDATA]"" D
98 ... S GMVITTYP(0)=$G(^GMRD(120.51,+GMVITTYP,0))
99 ... S GMVITTYP(1)=GMVITTYP,GMVITTYP(2)=$P(GMVITTYP(0),U,2)
100 ... S GMVITTYP(3)=$P(GMVITTYP(0),U)
101 ... S GMVITCAT(0)=$G(^GMRD(120.53,+GMVCATD0,0))
102 ... S GMVITCAT(1)=GMVCATD0,(GMVITCAT(2),GMVITCAT(3))=$P(GMVITCAT(0),U)
103 ... S GMVCNT=GMVCNT+1
104 ... S RESULT(GMVCNT)=GMVD0_U_$P(GMVDATA,U)_U_$P(GMVDATA,U,2)_U_GMVITTYP(GMVFMT)_U_GMVITCAT(GMVFMT)
105 ... Q
106 .. Q
107 . Q
108 Q
109 ;
110EN4(RESULT) ;
111 ; RPC: GMVDC GET VITAL TYPES
112 ; Get list of the vital types
113 ; Input:
114 ; None
115 ; Output:
116 ; RESULT() = VitalTypeIEN ^ VitalTypeName ^
117 ; VitalTypeAbbr ^ VitalTypePCE_Abbreviation
118 N GMVD0,GMVDATA
119 S GMVD0=0
120 F S GMVD0=$O(^GMRD(120.51,GMVD0)) Q:GMVD0'>0 D
121 . S GMVDATA=$G(^GMRD(120.51,GMVD0,0))
122 . I GMVDATA]"" S RESULT(GMVD0)=GMVD0_U_$P(GMVDATA,U)_U_$P(GMVDATA,U,2)_U_$P(GMVDATA,U,7)
123 . Q
124 S RESULT(0)="OK"
125 Q
126 ;
127EN5(RESULT,GMVDFN,GMVFMT,GMVABR,GMVMSYS) ;
128 ; RPC: GMVDC GET LATEST VITALS
129 ; Returns the latest vitals for a selected patient
130 ; Input:
131 ; GMVDFN = A pointer to the Patient file (#2) (Required)
132 ; GMVFMT = Format of returned data (Optional)
133 ; 1 - IENs (default), 2 - Abbreviations, 3 - Full Names
134 ; GMVABR = Abbreviations of vital types to return (Optional)
135 ; "^T^P^R^PO2^BP^HT^WT^CVP^CG^PN^" (Default)
136 ; "~ALL~" to return all vital types
137 ; GMVMSYS = Measurement system (Optional)
138 ; M = Metric, C - US Customary (Default)
139 ; Output:
140 ; RESULT() = VitalMeasurementIEN ^ DateTimeTaken ^ PatientDFN ^
141 ; VitalType ^ DateTimeEntered ^ HospitalLocation ^
142 ; EnteredBy ^ Measurement ^ EnteredInError ^
143 ; EnteredInErrorBy ^
144 ; Qualifier1 ; Qualifier2 ; ... ^
145 ; EnteredInErrorReason1 ; EnteredInErrorReason2 ; ... ^
146 D EN1^GMVDCEXT("^TMP(""GMV"",$J)",GMVDFN,$G(GMVFMT),$G(GMVABR),0,"","",$G(GMVMSYS),0)
147 S RESULT=$NA(^TMP("GMV",$J))
148 Q
149 ;
150EN6(RESULT,GMVDFN,GMVFMT,GMVABR,GMVBEG,GMVEND,GMVMSYS,GMVEE) ;
151 ; RPC: GMVDC GET VITALS
152 ; Returns vitals for a selected patient and date/time range
153 ; Input:
154 ; GMVDFN = A pointer to the Patient file (#2) (Required)
155 ; GMVFMT = Format of returned data (Optional)
156 ; 1 - IENs (default), 2 - Abbreviations, 3 - Full Names
157 ; GMVABR = Abbreviations of vital types to return (Optional)
158 ; "^T^P^R^PO2^BP^HT^WT^CVP^CG^PN^" (Default)
159 ; "~ALL~" to return all vital types
160 ; GMVBEG = Beginning date for all vitals (Not used for GMVALL = 0)
161 ; GMVEND = Ending date for all vitals (Not used for GMVALL = 0)
162 ; GMVMSYS = Measurement system (Optional)
163 ; M = Metric, C - US Customary (Default)
164 ; GMVEE = Include entered in error records (Optional)
165 ; (0 - No (Default), 1 - Yes)
166 ;
167 ; Output:
168 ; RESULT() = VitalMeasurementIEN ^ DateTimeTaken ^ PatientDFN ^
169 ; VitalType ^ DateTimeEntered ^ HospitalLocation ^
170 ; EnteredBy ^ Measurement ^ EnteredInError ^
171 ; EnteredInErrorBy ^
172 ; Qualifier1 ; Qualifier2 ; ... ^
173 ; EnteredInErrorReason1 ; EnteredInErrorReason2 ; ... ^
174 D EN1^GMVDCEXT("^TMP(""GMV"",$J)",GMVDFN,$G(GMVFMT),$G(GMVABR),1,$G(GMVBEG),$G(GMVEND),$G(GMVMSYS),$G(GMVEE))
175 S RESULT=$NA(^TMP("GMV",$J))
176 Q
177 ;
178EN7(RESULT,GMVITTYP) ;
179 ; RPC: GMVDC GET VITALS HELP
180 ; Get help text for a selected vital type
181 ; Input:
182 ; GMVITTYP = A pointer to GMRV Vital Type file (#120.51) (Optional)
183 ; Output:
184 ; RESULT() = Help text
185 S GMVITTYP=$$VITIEN^GMVDCUTL(GMVITTYP)
186 S GMVITTYP=$P($G(^GMRD(120.51,+GMVITTYP,0)),U,2)
187 I GMVITTYP]"" D
188 . D HELP^GMVDCHLP(.RESULT,GMVITTYP)
189 . S RESULT(0)="OK"
190 . I $O(RESULT(0))'>0 S RESULT(1)="No help text available."
191 . Q
192 E D
193 . S RESULT(0)="ERROR"
194 . S RESULT(1)="ERROR: Missing or invalid Vital Type parameter"
195 . Q
196 Q
197 ;
198EN8(RESULT,GMVPARAM) ;
199 ; RPC: GMVDC SAVE VITALS
200 ; Saves vitals data
201 N GMVDFN,GMVDTDUN,GMVDTENT,GMVENTBY,GMVERRBY,GMVHOSPL,GMVMSYS K RESULT
202 S RESULT(0)="OK"
203 S GMVDATA="^TMP(""GMV"",$J)"
204 D FMTPARAM^GMVDCUTL(.GMVPARAM,GMVDATA)
205 D EN1^GMVDCVAL(.RESULT,GMVDATA)
206 I $G(RESULT(0))="OK" D EN1^GMVDCSAV(.RESULT,GMVDATA)
207 K RESULT(-1)
208 Q
209 ;
210EN9(RESULT,GMVPARAM) ;
211 ; RPC: GMVDC VALIDATE VITALS
212 ; Validates vitals data
213 N GMVDFN,GMVDTDUN,GMVDTENT,GMVENTBY,GMVERRBY,GMVHOSPL,GMVMSYS K RESULT
214 S RESULT(0)="OK"
215 S GMVDATA="^TMP(""GMV"",$J)"
216 D FMTPARAM^GMVDCUTL(.GMVPARAM,GMVDATA)
217 D EN1^GMVDCVAL(.RESULT,GMVDATA)
218 K RESULT(-1)
219 Q
220 ;
221EN10(RESULT,GMVMSYS) ;
222 ; RPC: GMVDC GET ABNORMAL RANGES
223 ; Returns the abnormal ranges for the vital types
224 ; Input:
225 ; GMVMSYS = Measurement system (Optional)
226 ; M = Metric, C - US Customary (Default)
227 ; Output:
228 ; RESULT(1) = TEMP-HIGH ^ TEMP-LOW ^ PULSE-HIGH ^ PULSE-LOW ^
229 ; RESP-HIGH ^ RESP-LOW ^ SYSTOLIC-HIGH ^ DIASTOLIC-HIGH ^
230 ; SYSTOLIC-LOW ^ DIASTOLIC-LOW ^ CVP-HIGH ^ CVP-LOW ^
231 ; O2SAT-LOW
232 N GMVABBR,GMVALUE,GMVPIECE K RESULT
233 S GMVMSYS=$$MEASYS^GMVDCUTL($G(GMVMSYS))
234 S RESULT(0)="OK"
235 S RESULT(1)=$P($G(^GMRD(120.57,1,1)),U,1,13)
236 F GMVPIECE=1,2,11,12 D
237 . S GMVABBR=$P("T^T^^^^^^^^^CVP^CVP",U,GMVPIECE)
238 . S GMVALUE=$P(RESULT(1),U,GMVPIECE)
239 . S GMVALUE=$$CNV^GMVDCCNV(GMVALUE,GMVMSYS,"G",GMVABBR)
240 . S $P(RESULT(1),U,GMVPIECE)=GMVALUE
241 . Q
242 Q
Note: See TracBrowser for help on using the repository browser.