fix infinite loop bug if more than one med

This commit is contained in:
cje 2008-07-30 19:11:28 +00:00
parent 6595d3260c
commit 2900ce0eb8
1 changed files with 6 additions and 9 deletions

View File

@ -31,8 +31,8 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
I '$D(MEDRSLT(1)) W "ERROR RUNNINIG MEDICATIONS RPC",! Q
S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
F J=1:1 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
. W "J IS",J,!
F J=1:3 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
. W "J IS ",J,!
. S MEDVMAP=$NA(@MEDTVMAP@(J))
. K @MEDVMAP
. I DEBUG W "VMAP= ",VMAP,!
@ -56,22 +56,19 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")=""
. S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")=""
. S @MEDVMAP@("MEDICATIONFORMTEXT")=""
. S J=J+1
. S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J)," *",2)
. S J=J+1
. S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J),"\ Sig: ",2)
. S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+1)," *",2)
. S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+2),"\ Sig: ",2)
. S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")=""
. S MEDARYTMP=$NA(@MEDTARYTMP@(J))
. K @MEDARYTMP
. D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
. I J=3 D ; FIRST ONE IS JUST A COPY
. I J=1 D ; FIRST ONE IS JUST A COPY
. . ; W "FIRST ONE",!
. . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
. I J>3 D ; AFTER THE FIRST, INSERT INNER XML
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
. . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
. S J=J+1
N MEDTMP,MEDI
D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@