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

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

Added GPL Copywrite notice

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