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

Last change on this file since 109 was 97, checked in by George Lilly, 16 years ago

killed value arrays at beginning of processing for Vitals and Problems

File size: 10.8 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 Q
22 ;
23EXTRACT(VITXML,DFN,VITOUTXML) ; EXTRACT VITALS INTO PROVIDED XML TEMPLATE
24 ;
25 ; VITXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
26 ; IVITXML WILL CONTAIN ONLY THE VITALS SECTION OF THE OVERALL TEMPLATE
27 ;
28 N VITRSLT,J,K,VITPTMP,X,VITVMAP,TBUF
29 D VITALS^ORQQVI(.VITRSLT,DFN,"","")
30 I $P(VITRSLT(1),U,2)="No vitals found." D ; NULL RESULT FROM RPC
31 . W "NO VITALS FOUND FROM VITALS RPC",!
32 . S @VITOUTXML@(0)=0
33 . Q
34 ; ZWR RPCRSLT
35 S VITTVMAP=$NA(^TMP("GPLCCR",$J,"VITALS"))
36 S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
37 K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
38 F J=1:1:VITRSLT(1) D ; FOR EACH VITAL IN THE LIST
39 . I $D(VITRSLT(J)) D
40 . . S VITVMAP=$NA(@VITTVMAP@(J))
41 . . K @VITVMAP
42 . . I DEBUG W "VMAP= ",VITVMAP,!
43 . . S VITPTMP=VITRSLT(J) ; PULL OUT VITAL FROM RPC RETURN ARRAY
44 . . S @VITVMAP@("VITALSIGNSDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR VITAL
45 . . I $P(VITPTMP,U,2)="HT" D
46 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
47 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
48 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
49 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
50 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
51 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
52 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="HEIGHT"
53 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="248327008"
54 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
55 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
56 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
57 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
58 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="in"
59 . . E I $P(VITPTMP,U,2)="WT" D
60 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
61 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
62 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
63 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
64 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
65 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
66 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="WEIGHT"
67 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="107647005"
68 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
69 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
70 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
71 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
72 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="lbs"
73 . . E I $P(VITPTMP,U,2)="BP" D
74 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
75 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
76 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
77 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
78 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
79 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
80 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="BLOOD PRESSURE"
81 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="392570002"
82 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
83 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
84 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
85 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
86 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
87 . . E I $P(VITPTMP,U,2)="T" D
88 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
89 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
90 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
91 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
92 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
93 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
94 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="TEMPERATURE"
95 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="309646008"
96 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
97 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
98 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
99 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
100 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="F"
101 . . E I $P(VITPTMP,U,2)="R" D
102 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
103 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
104 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
105 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
106 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
107 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
108 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="RESPIRATION"
109 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="366147009"
110 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
111 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
112 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
113 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
114 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
115 . . E I $P(VITPTMP,U,2)="P" D
116 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
117 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
118 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
119 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
120 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
121 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
122 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PULSE"
123 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="366199006"
124 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
125 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
126 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
127 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
128 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
129 . . E I $P(VITPTMP,U,2)="PN" D
130 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
131 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
132 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
133 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
134 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
135 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="OBSERVED"
136 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="PAIN"
137 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")="22253000"
138 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")="SNOMED"
139 . . . S @VITVMAP@("VITALSIGNSCODEVERSION")=""
140 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
141 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
142 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")=""
143 . . E D
144 . . . ;W "IN VITAL: OTHER",!
145 . . . S @VITVMAP@("VITALSIGNSDATETIMETYPETEXT")="OBSERVED"
146 . . . S @VITVMAP@("VITALSIGNSEXACTDATETIME")=$$FMDTOUTC^CCRUTIL($P(VITPTMP,U,4),"DT")
147 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER VITAL"
148 . . . S @VITVMAP@("VITALSIGNSSOURCEACTORID")="ACTORSYSTEM_1"
149 . . . S @VITVMAP@("VITALSIGNSTESTOBJECTID")="VITALTEST"_J
150 . . . S @VITVMAP@("VITALSIGNSTESTTYPETEXT")="UNKNOWN"
151 . . . S @VITVMAP@("VITALSIGNSDESCRIPTIONTEXT")="OTHER"
152 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODEVALUE")=""
153 . . . ;S @VITVMAP@("VITALSIGNSDESCRIPTIONCODINGSYSTEM")=""
154 . . . ;S @VITVMAP@("VITALSIGNSCODEVERSION")=""
155 . . . S @VITVMAP@("VITALSIGNSTESTSOURCEACTORID")="ACTORPROVIDER_"_$P(^GMR(120.5,$P(VITPTMP,U,1),0),U,6)
156 . . . S @VITVMAP@("VITALSIGNSTESTRESULTVALUE")=$P(VITPTMP,U,3)
157 . . . S @VITVMAP@("VITALSIGNSTESTRESULTUNIT")="UNKNOWN"
158 . . S VITARYTMP=$NA(@VITTARYTMP@(J))
159 . . K @VITARYTMP
160 . . D MAP^GPLXPATH(VITXML,VITVMAP,VITARYTMP)
161 . . I J=1 D ; FIRST ONE IS JUST A COPY
162 . . . ; W "FIRST ONE",!
163 . . . D CP^GPLXPATH(VITARYTMP,VITOUTXML)
164 . . . W "VITOUTXML ",VITOUTXML,!
165 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
166 . . . D INSINNER^GPLXPATH(VITOUTXML,VITARYTMP)
167 ; ZWR ^TMP($J,"VITALS",*)
168 ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
169 I DEBUG D PARY^GPLXPATH(VITOUTXML)
170 N VITTMP,I
171 D MISSING^GPLXPATH(VITOUTXML,"VITTMP") ; SEARCH XML FOR MISSING VARS
172 I VITTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
173 . W "VITALS MISSING ",!
174 . F I=1:1:VITTMP(0) W VITTMP(I),!
175 Q
176 ;
Note: See TracBrowser for help on using the repository browser.