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

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

added processing for meds in GPLCCR.m
added <description><text></text></description> for meds in GPLCCR0.m
changed I variables in GPLCCR.m so that it would run

File size: 4.2 KB
Line 
1GPLMEDS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR MEDICATIONS ;07/23/08 14:33
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(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
24 ;
25 ; MEDXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
26 ; IMEDXML WILL CONTAIN ONLY THE MEDICATIONS SECTION OF THE OVERALL TEMPLATE
27 ;
28 N MEDRSLT,J,K,MEDPTMP,X,MEDVMAP,TBUF
29 D ACTIVE^ORWPS(.MEDRSLT,DFN)
30 ZWR MEDRSLT
31 I '$D(MEDRSLT(1)) W "ERROR RUNNINIG MEDICATIONS RPC",! Q
32 S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
33 S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
34 F J=1:1 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
35 . W "J IS",J,!
36 . S MEDVMAP=$NA(@MEDTVMAP@(J))
37 . K @MEDVMAP
38 . I DEBUG W "VMAP= ",VMAP,!
39 . S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY
40 . S @MEDVMAP@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDICATION
41 . ; PROCESSING FOR MEDS GOES HERE
42 . S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT") ; GETS LAST FILL DATE
43 . S @MEDVMAP@("MEDICATIONDATETIMEAGE")=""
44 . S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")=""
45 . S @MEDVMAP@("MEDICATIONTYPETEXT")="Medication"
46 . S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10) ; STATUS FROM RPC
47 . S @MEDVMAP@("MEDICATIONSOURCEACTORID")=""
48 . S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")=$P(MEDPTMP,"^",3)
49 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")=""
50 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")=""
51 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")=""
52 . S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")=""
53 . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")=""
54 . S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")=""
55 . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")=""
56 . S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")=""
57 . S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")=""
58 . S @MEDVMAP@("MEDICATIONFORMTEXT")=""
59 . S J=J+1
60 . S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J)," *",2)
61 . S J=J+1
62 . S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J),"\ Sig: ",2)
63 . S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")=""
64 . S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")=""
65 . S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")=""
66 . S MEDARYTMP=$NA(@MEDTARYTMP@(J))
67 . K @MEDARYTMP
68 . D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
69 . I J=3 D ; FIRST ONE IS JUST A COPY
70 . . ; W "FIRST ONE",!
71 . . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
72 . I J>3 D ; AFTER THE FIRST, INSERT INNER XML
73 . . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
74 . S J=J+1
75 N MEDTMP,MEDI
76 D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
77 I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
78 . W "MEDICATION MISSING ",!
79 . F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
80 Q
81 ;
Note: See TracBrowser for help on using the repository browser.