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

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

First commit for CCD

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