source: ccr/trunk/p/GPLVITALS.m@ 70

Last change on this file since 70 was 65, checked in by Christopher Edwards, 16 years ago

created skeleton for Meds

File size: 10.6 KB
Line 
1GPLVITALS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR VITALS ; 07/16/08
2 ;;0.1;CCDCCR;;JUL 16,2008;
3 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 W "NO ENTRY FROM TOP",!
21 W !
22 Q
23 ;
24EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
25 ;
26 ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
27 ; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
28 ;
29 N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
30 D VITALS^ORQQVI(.VITRSLT,DFN,"","")
31 I '$D(VITRSLT(1)) W "ERROR RUNNINIG VITALS RPC",! Q
32 ; ZWR RPCRSLT
33 S VITTVMAP=$NA(^TMP("GPLCCR",$J,"VITALS"))
34 S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
35 F J=1:1:VITRSLT(1) D ; FOR EACH VITAL IN THE LIST
36 . I $D(VITRSLT(J)) D
37 . . S VITVMAP=$NA(@VITTVMAP@(J))
38 . . K @VITVMAP
39 . . I DEBUG W "VMAP= ",VMAP,!
40 . . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
41 . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
42 . . I $P(VITPTMP,U,2)="HT" D
43 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
44 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
45 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
46 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
47 . . . ;S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
48 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
49 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
50 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
51 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
52 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
53 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
54 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
55 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
56 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
57 . . E I $P(VITPTMP,U,2)="WT" D
58 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
59 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
60 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
61 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
62 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
63 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
64 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
65 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
66 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
67 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
68 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
69 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
70 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
71 . . E I $P(VITPTMP,U,2)="BP" D
72 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
73 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
74 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
75 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
76 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
77 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
78 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
79 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
80 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
81 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
82 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
83 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
84 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
85 . . E I $P(VITPTMP,U,2)="T" D
86 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
87 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
88 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
89 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
90 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
91 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
92 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
93 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
94 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
95 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
96 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
97 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
98 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="F"
99 . . E I $P(VITPTMP,U,2)="R" D
100 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
101 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
102 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
103 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
104 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
105 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
106 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
107 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
108 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
109 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
110 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
111 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
112 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
113 . . E I $P(VITPTMP,U,2)="P" D
114 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
115 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
116 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
117 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
118 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
119 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
120 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
121 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
122 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
123 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
124 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
125 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
126 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
127 . . E I $P(VITPTMP,U,2)="PN" D
128 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
129 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
130 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
131 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
132 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
133 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
134 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
135 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
136 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
137 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
138 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
139 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
140 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
141 . . E D
142 . . . ;W "IN VITAL: OTHER",!
143 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
144 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
145 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
146 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
147 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
148 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="UNKNOWN"
149 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
150 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
151 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
152 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVERSION")=""
153 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
154 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
155 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
156 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
157 . . K @VITARYTMP
158 . . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
159 . . I J=1 D ; FIRST ONE IS JUST A COPY
160 . . . ; W "FIRST ONE",!
161 . . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
162 . . . ; W "OUTXML ",OUTXML,!
163 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
164 . . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
165 ; ZWR ^TMP($J,"VITALS",*)
166 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
167 ; ZWR @OUTXML
168 N VITTMP,I
169 D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
170 I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
171 . W "VITALS MISSING ",!
172 . F I=1:1:VITTMP(0) W VITTMP(I),!
173 Q
174 ;
Note: See TracBrowser for help on using the repository browser.