fix for meds

This commit is contained in:
george 2008-10-26 00:20:47 +00:00
parent 5a6232a427
commit 2fe1ec7d13
1 changed files with 5 additions and 2 deletions

View File

@ -48,6 +48,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
I DEBUG ZWR MEDS
N RXIEN S RXIEN=0
N MEDCOUNT S MEDCOUNT=0
N MEDFIRST S MEDFIRST=1 ; FLAG FOR FIRST MED IN THIS SECTION FOR MERGING
S MEDMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP")) ; THIS IS THE VARIABLE MAP
S MEDCOUNT=@MEDMAP@(0) ; ACCOUNT FOR MEDS ALREADY IN ARRAY
F S RXIEN=$O(MEDS(RXIEN)) Q:RXIEN="B" D ; FOR EACH MEDICATION IN THE LIST
@ -204,8 +205,10 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",MDZ1))
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
. . . D INSERT^GPLXPATH(RESULT,DIRXML2,"//Medications/Medication")
. D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
. D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
. I MEDFIRST D ;
. . S MEDFIRST=0 ; RESET FIRST FLAG
. . D CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
. D:'MEDFIRST INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER XML
N MEDTMP,MEDI
D MISSING^GPLXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@