source: ccr/trunk/p/GPLMEDS.m@ 69

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

created skeleton for Meds

File size: 2.7 KB
Line 
1GPLVITALS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR MEDICATIONS ; 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(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
25 ;
26 ; MEDXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
27 ; IMEDXML WILL CONTAIN ONLY THE MEDICATIONS SECTION OF THE OVERALL TEMPLATE
28 ;
29 N MEDRSLT,J,K,MEDPTMP,X,MEDVMAP,TBUF
30 ; REPLACE ME WITH MEDS RPC!!
31 I '$D(MEDRSLT(1)) W "ERROR RUNNINIG MEDICATIONS RPC",! Q
32 ; ZWR RPCRSLT
33 S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"VITALS"))
34 S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
35 F J=1:1:MEDRSLT(1) D ; FOR EACH MEDICATION IN THE LIST
36 . I $D(MEDRSLT(J)) D
37 . . S MEDVMAP=$NA(@MEDTVMAP@(J))
38 . . K @MEDVMAP
39 . . I DEBUG W "VMAP= ",VMAP,!
40 . . S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY
41 . . S @MEDVMAP@("MEDDATAOBJECTID")="VITAL"_J ; UNIQUE OBJID FOR MEDICATION
42 . . ; PROCESSING FOR MEDS GOES HERE
43 . . S MEDARYTMP=$NA(@MEDTARYTMP@(J))
44 . . K @MEDARYTMP
45 . . D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
46 . . I J=1 D ; FIRST ONE IS JUST A COPY
47 . . . ; W "FIRST ONE",!
48 . . . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
49 . . . ; W "OUTXML ",OUTXML,!
50 . . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
51 . . . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
52 ; ZWR ^TMP($J,"VITALS",*)
53 ; ZWR ^TMP($J,"VITALARYTMP",*) ; SHOW THE RESULTS
54 ; ZWR @OUTXML
55 N MEDTMP,I
56 D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
57 I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
58 . W "MEDICATION MISSING ",!
59 . F I=1:1:MEDTMP(0) W MEDTMP(I),!
60 Q
61 ;
Note: See TracBrowser for help on using the repository browser.