1 | GPLMEDS ; 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 | ;
|
---|
24 | EXTRACT(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 | D ACTIVE^ORWPS(.MEDRSLT,DFN)
|
---|
31 | ZWR MEDRSLT
|
---|
32 | Q
|
---|
33 | I '$D(MEDRSLT(1)) W "ERROR RUNNINIG MEDICATIONS RPC",! Q
|
---|
34 | S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
|
---|
35 | S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
|
---|
36 | F J=1:1 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
|
---|
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@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDICATION
|
---|
42 | . ; PROCESSING FOR MEDS GOES HERE
|
---|
43 | . S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT")
|
---|
44 | . S @MEDVMAP@("MEDICATIONDATETIMEAGE")="TEST2"
|
---|
45 | . S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")="TEST3"
|
---|
46 | . S @MEDVMAP@("MEDICATIONTYPETEXT")="TEST4"
|
---|
47 | . S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10)
|
---|
48 | . S @MEDVMAP@("MEDICATIONSOURCEACTORID")="TEST6"
|
---|
49 | . S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")="TEST7"
|
---|
50 | . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")="TEST8"
|
---|
51 | . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")="TEST9"
|
---|
52 | . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")="TEST10"
|
---|
53 | . S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")="TEST11"
|
---|
54 | . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")="TEST12"
|
---|
55 | . S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")="TEST13"
|
---|
56 | . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")="TEST14"
|
---|
57 | . S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")="TEST15"
|
---|
58 | . S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")="TEST16"
|
---|
59 | . S @MEDVMAP@("MEDICATIONFORMTEXT")="TEST17"
|
---|
60 | . S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")="TEST18"
|
---|
61 | . S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")="TEST19"
|
---|
62 | . S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")="TEST20"
|
---|
63 | . S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")="TEST21"
|
---|
64 | . S J=J+3
|
---|
65 | . S MEDARYTMP=$NA(@MEDTARYTMP@(J))
|
---|
66 | . K @MEDARYTMP
|
---|
67 | . D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
|
---|
68 | . I J=1 D ; FIRST ONE IS JUST A COPY
|
---|
69 | . . ; W "FIRST ONE",!
|
---|
70 | . . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
|
---|
71 | . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
---|
72 | . . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
|
---|
73 | N MEDTMP,I
|
---|
74 | D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
---|
75 | I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
---|
76 | . W "MEDICATION MISSING ",!
|
---|
77 | . F I=1:1:MEDTMP(0) W MEDTMP(I),!
|
---|
78 | Q
|
---|
79 | ;
|
---|