chained C0CMED3 & C0CMED6 together to get non-va meds for RPMS

This commit is contained in:
cje 2010-01-27 17:15:57 +00:00
parent 1d98cebe9e
commit b2eeef7fa8
1 changed files with 96 additions and 81 deletions

View File

@ -53,7 +53,22 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; Private; Extract medications into provided XML t
I $$RPMS^C0CUTIL() D RPMS QUIT
I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
RPMS
D EXTRACT^C0CMED6(MEDXML,DFN,MEDOUTXML,C0CMFLAG) QUIT
;D EXTRACT^C0CMED6(MEDXML,DFN,MEDOUTXML,C0CMFLAG) QUIT
N MEDCOUNT S MEDCOUNT=0
K ^TMP($J,"MED")
N HIST S HIST=$NA(^TMP($J,"MED","HIST")) ; Meds already dispensed
N NVA S NVA=$NA(^TMP($J,"MED","NVA")) ; non-VA Meds
S @HIST@(0)=0,@NVA@(0)=0 ; At first, they are all empty... (prevent undefined errors)
D EXTRACT^C0CMED6(MEDXML,DFN,HIST,.MEDCOUNT,C0CMFLAG) ; Historical OP Meds
D:+C0CMFLAG EXTRACT^C0CMED3(MEDXML,DFN,NVA,.MEDCOUNT) ; non-VA Meds
I @HIST@(0)>0 D
. D CP^C0CXPATH(HIST,MEDOUTXML)
. W:$G(DEBUG) "HAS ACTIVE OP MEDS",!
I @NVA@(0)>0 D
. I @HIST@(0)>0 D INSINNER^C0CXPATH(MEDOUTXML,NVA)
. ;E D CP^C0CXPATH(NVA,MEDOUTXML)
. W:$G(DEBUG) "HAS NON-VA MEDS",!
Q
VISTA
N MEDCOUNT S MEDCOUNT=0
K ^TMP($J,"MED")