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

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

fixed debugging call

File size: 3.7 KB
RevLine 
[73]1GPLMEDS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR MEDICATIONS ;07/23/08 14:33
[86]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 ;
[90]20 W "NO ENTRY FROM TOP",!
21 Q
22 ;
[73]23EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
[86]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 ;
[90]28 N MEDRSLT,I,J,K,MEDPTMP,X,MEDVMAP,TBUF
29 D ACTIVE^ORWPS(.MEDRSLT,DFN)
30 I '$D(MEDRSLT(1)) D ; NO MEDS FOR THIS PATIENT, EXIT
31 . W "ERROR RUNNINIG MEDICATIONS RPC",!
32 . S @MEDOUTXML@(0)=0
33 . Q
[93]34 I DEBUG ZWR MEDRSLT
[90]35 S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
36 S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
37 F J=1:3 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
[93]38 . I DEBUG W "J IS ",J,!
[90]39 . S MEDVMAP=$NA(@MEDTVMAP@(J))
40 . K @MEDVMAP
[94]41 . I DEBUG W "VMAP= ",MEDVMAP,!
[90]42 . S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY
43 . S @MEDVMAP@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDS
44 . ; PROCESSING FOR MEDS GOES HERE
[93]45 . S @MEDVMAP@("MEDISSUEDATETXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT") ; GETS LAST FILL DATE
[90]46 . S @MEDVMAP@("MEDICATIONDATETIMEAGE")=""
47 . S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")=""
[93]48 . S @MEDVMAP@("MEDTYPETEXT")="Medication"
49 . S @MEDVMAP@("MEDSTATUSTEXT")=$P(MEDPTMP,"^",10) ; STATUS FROM RPC
50 . S @MEDVMAP@("MEDSOURCEACTORID")="ACTORSYSTEM_1"
51 . S @MEDVMAP@("MEDPRODUCTNAMETEXT")=$P(MEDPTMP,"^",3)
[90]52 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")=""
53 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")=""
54 . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")=""
[93]55 . S @MEDVMAP@("MEDBRANDNAMETEXT")=""
[90]56 . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")=""
57 . S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")=""
58 . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")=""
[93]59 . S @MEDVMAP@("MEDSTRENGTHVALUE")=""
60 . S @MEDVMAP@("MEDSTRENGTHUNIT")=""
61 . S @MEDVMAP@("MEDFORMTEXT")=""
62 . S @MEDVMAP@("MEDQUANTITYVALUE")=""
63 . S @MEDVMAP@("MEDQUANTITYUNIT")=""
64 . S @MEDVMAP@("MEDRFNO")=""
[90]65 . S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+1)," *",2)
[93]66 . S @MEDVMAP@("MEDDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+2),"\ Sig: ",2)
[90]67 . S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")=""
68 . S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")=""
69 . S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")=""
70 . S MEDARYTMP=$NA(@MEDTARYTMP@(J))
71 . K @MEDARYTMP
72 . D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
73 . I J=1 D ; FIRST ONE IS JUST A COPY
74 . . ; W "FIRST ONE",!
75 . . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
76 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
77 . . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
78 N MEDTMP,MEDI
79 D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
80 I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
81 . W "MEDICATION MISSING ",!
82 . F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
83 Q
84 ;
Note: See TracBrowser for help on using the repository browser.