namespacing
This commit is contained in:
parent
7e5c140e39
commit
21f9587a3f
31
p/CCRMEDS.m
31
p/CCRMEDS.m
|
@ -1,7 +1,8 @@
|
|||
CCRMEDS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR MEDICATIONS ;07/23/08 14:33
|
||||
;;0.1;CCDCCR;;JUL 16,2008;
|
||||
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
|
||||
;General Public License See attached copy of the License.
|
||||
;Copyright 2008,2009 George Lilly, University of Minnesota and Sam Habiel.
|
||||
;Licensed under the terms of the GNU General Public License.
|
||||
;See attached copy of the License.
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or modify
|
||||
;it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,10 +33,10 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
; NON-VA MEDS IN EXTRACT^CCRMEDS3
|
||||
; INPATIENT MEDS IN EXTRACT^CCRMEDS4
|
||||
; ALL OTHERS HERE
|
||||
S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP"))
|
||||
S MEDTVMAP=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
|
||||
K @MEDTVMAP ; CLEAR VARIABLE ARRAY
|
||||
S @MEDTVMAP@(0)=0 ; INITIALIZE NUMBER OF MEDS PROCESSED
|
||||
S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
|
||||
S MEDTARYTMP=$NA(^TMP("C0CCCR",$J,"MEDARYTMP"))
|
||||
K @MEDTARYTMP ; KILL XML ARRAY
|
||||
I $G(DUZ("AG"))="I" D Q ;
|
||||
. ; I '$D(C0CTESTMEDS) G USERPC ; DELETE THIS LINE AFTER TESTING IS DONE
|
||||
|
@ -53,8 +54,8 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
I @PENDINGXML@(0)>0 D ; CCRMEDS FOUND PENDING OP MEDS
|
||||
. S HASOP=1 ; SET FLAG TO KNOW HOW TO ADD XML
|
||||
. I @MEDOUTXML@(0)>0 D ; IF WE NEED TO COMBINE MEDS
|
||||
. . D INSINNER^GPLXPATH(MEDOUTXML,PENDINGXML) ;ADD PENDING TO ACTIVE
|
||||
. E D CP^GPLXPATH(PENDINGXML,MEDOUTXML) ; NO ACTIVE MEDS, JUST COPY
|
||||
. . D INSINNER^C0CXPATH(MEDOUTXML,PENDINGXML) ;ADD PENDING TO ACTIVE
|
||||
. E D CP^C0CXPATH(PENDINGXML,MEDOUTXML) ; NO ACTIVE MEDS, JUST COPY
|
||||
. S MEDCNT=MEDCNT+@MEDTVMAP@(0) ; SAVE COUNT TO KNOW HOW TO ADD TO MAP
|
||||
. ; W MEDCNT,!
|
||||
. W "HAS OP PENDING MEDS",!
|
||||
|
@ -64,8 +65,8 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
I @PENDINGXML@(0)>0 D ; CCRMEDS FOUND PENDING OP MEDS
|
||||
. ; S HASOP=1 ; SET FLAG TO KNOW HOW TO ADD XML
|
||||
. I @MEDOUTXML@(0)>0 D ; IF WE NEED TO COMBINE MEDS
|
||||
. . D INSINNER^GPLXPATH(MEDOUTXML,PENDINGXML) ;ADD NON-VA TO MEDS
|
||||
. E D CP^GPLXPATH(PENDINGXML,MEDOUTXML) ; NO PREVIOUS MEDS, JUST COPY
|
||||
. . D INSINNER^C0CXPATH(MEDOUTXML,PENDINGXML) ;ADD NON-VA TO MEDS
|
||||
. E D CP^C0CXPATH(PENDINGXML,MEDOUTXML) ; NO PREVIOUS MEDS, JUST COPY
|
||||
. S MEDCNT=MEDCNT+@MEDTVMAP@(0) ; SAVE COUNT TO KNOW HOW TO ADD TO MAP
|
||||
. ; W MEDCNT,!
|
||||
. W "HAS NON-VA MEDS",!
|
||||
|
@ -80,9 +81,9 @@ USERPC ; ENTRY POINT FOR RPMS
|
|||
. S @MEDOUTXML@(0)=0
|
||||
. Q
|
||||
; I DEBUG ZWR MEDRSLT
|
||||
M GPLMEDS=MEDRSLT
|
||||
S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP"))
|
||||
S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
|
||||
M C0CMEDS=MEDRSLT
|
||||
S MEDTVMAP=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
|
||||
S MEDTARYTMP=$NA(^TMP("C0CCCR",$J,"MEDARYTMP"))
|
||||
; I 'HASOP K @MEDTVMAP,@MEDTARYTMP KILL MOVED TO TOP OF ROUTINE
|
||||
; FIRST GO THROUGH MEDRSLT ARRAY AND COUNT MEDS AND LINES IN MEDS
|
||||
; ZA(0) IS TOTAL NUMBER OF MEDS ZA(ZI) IS LINES IN MED ZI
|
||||
|
@ -187,14 +188,14 @@ USERPC ; ENTRY POINT FOR RPMS
|
|||
. S @MEDVMAP@("MEDDIRECTIONFREQUENCYVALUE")=""
|
||||
. S MEDARYTMP=$NA(@MEDTARYTMP@(ZI))
|
||||
. K @MEDARYTMP
|
||||
. D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
|
||||
. D MAP^C0CXPATH(MEDXML,MEDVMAP,MEDARYTMP)
|
||||
. I ZI=1&('HASOP) D ; FIRST ONE IS JUST A COPY MAKE SURE OP IS NOT THERE
|
||||
. . ; W "FIRST ONE",!
|
||||
. . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
|
||||
. . D CP^C0CXPATH(MEDARYTMP,MEDOUTXML)
|
||||
. E D ; AFTER THE FIRST OR IF THERE ARE OP, INSERT INNER XML
|
||||
. . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
|
||||
. . D INSINNER^C0CXPATH(MEDOUTXML,MEDARYTMP)
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
D MISSING^C0CXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
. W "MEDICATION MISSING ",!
|
||||
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
|
||||
|
|
26
p/CCRMEDS1.m
26
p/CCRMEDS1.m
|
@ -35,7 +35,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
; med data available.
|
||||
; http://www.va.gov/vdl/documents/Clinical/Pharm-Outpatient_Pharmacy/phar_1_api_r0807.pdf
|
||||
; Output of API is ^TMP($J,"SUBSCRIPT",DFN,RXIENS).
|
||||
; D PARY^GPLXPATH(MINXML)
|
||||
; D PARY^C0CXPATH(MINXML)
|
||||
N MEDS,MAP
|
||||
K ^TMP($J,"CCDCCR") ; PLEASE DON'T KILL ALL OF ^TMP($J) HERE!!!!
|
||||
D RX^PSO52API(DFN,"CCDCCR")
|
||||
|
@ -46,12 +46,12 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
I DEBUG ZWR MEDS
|
||||
N RXIEN S RXIEN=0
|
||||
N MEDCOUNT S MEDCOUNT=0
|
||||
S MEDMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP")) ; THIS IS THE VARIABLE MAP
|
||||
S MEDMAP=$NA(^TMP("C0CCCR",$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="" D ; FOR EACH MEDICATION IN THE LIST
|
||||
. S MEDCOUNT=MEDCOUNT+1
|
||||
. I DEBUG W "RXIEN IS ",RXIEN,!
|
||||
. S MAP=$NA(^TMP("GPLCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. S MAP=$NA(^TMP("C0CCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. ; K @MAP DO NOT KILL HERE, WAS CLEARED IN CCRMEDS
|
||||
. S @MEDMAP@(0)=@MEDMAP@(0)+1 ; INCREMENT TOTAL MEDS IN VAR ARRAY
|
||||
. I DEBUG W "MAP= ",MAP,!
|
||||
|
@ -203,25 +203,25 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
. ; ^PSRX(22,"PRC",1,0)="Pharmacist: you must obey my command"
|
||||
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=$G(^PSRX(RXIEN,"PRC",1,0))
|
||||
. S @MAP@("MEDRFNO")=MED(9)
|
||||
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
||||
. N RESULT S RESULT=$NA(^TMP("C0CCCR",$J,"MAPPED"))
|
||||
. K @RESULT
|
||||
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^GPLXPATH(RESULT)
|
||||
. D MAP^C0CXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^C0CXPATH(RESULT)
|
||||
. ; MAPPING DIRECTIONS
|
||||
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
|
||||
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
|
||||
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. D QUERY^C0CXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^C0CXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. ; N MDZ1,MDZNA
|
||||
. I DIRCNT>0 D ; IF THERE ARE DIRCTIONS
|
||||
. . F MDZ1=1:1:DIRCNT D ; FOR EACH DIRECTION
|
||||
. . . 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
|
||||
. . . D MAP^C0CXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. D:MEDCOUNT=1 CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:MEDCOUNT>1 INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^GPLXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
. W "MEDICATION MISSING ",!
|
||||
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
|
||||
|
|
24
p/CCRMEDS2.m
24
p/CCRMEDS2.m
|
@ -50,13 +50,13 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
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 MEDMAP=$NA(^TMP("C0CCCR",$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
|
||||
. I $$GET1^DIQ(52.41,RXIEN,2,"I")="RF" QUIT ; Dont' want refill request as a "pending" order
|
||||
. S MEDCOUNT=MEDCOUNT+1
|
||||
. I DEBUG W "RXIEN IS ",RXIEN,!
|
||||
. S MAP=$NA(^TMP("GPLCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. S MAP=$NA(^TMP("C0CCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. ; K @MAP DON'T KILL MAP HERE, IT IS DONE IN CCRMEDS
|
||||
. S @MEDMAP@(0)=@MEDMAP@(0)+1 ; INCREMENT TOTAL MEDS IN VAR ARRAY
|
||||
. I DEBUG W "MAP= ",MAP,!
|
||||
|
@ -242,27 +242,27 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM
|
|||
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=$G(^PSRX(RXIEN,"SIG1",1,0)) ;GPL
|
||||
. ; W @MAP@("MEDFULLFILLMENTINSTRUCTIONS"),!
|
||||
. S @MAP@("MEDRFNO")=$$GET1^DIQ(52.41,RXIEN,13)
|
||||
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
||||
. N RESULT S RESULT=$NA(^TMP("C0CCCR",$J,"MAPPED"))
|
||||
. K @RESULT
|
||||
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^GPLXPATH(RESULT)
|
||||
. D MAP^C0CXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^C0CXPATH(RESULT)
|
||||
. ; MAPPING DIRECTIONS
|
||||
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
|
||||
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
|
||||
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. D QUERY^C0CXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^C0CXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. ; N MDZ1,MDZNA
|
||||
. I DIRCNT>0 D ; IF THERE ARE DIRCTIONS
|
||||
. . F MDZ1=1:1:DIRCNT D ; FOR EACH DIRECTION
|
||||
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",MDZ1))
|
||||
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^GPLXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. . . D MAP^C0CXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. 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
|
||||
. . D CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER XML
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^GPLXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
. W "MEDICATION MISSING ",!
|
||||
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
|
||||
|
|
24
p/CCRMEDS3.m
24
p/CCRMEDS3.m
|
@ -49,14 +49,14 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
|||
;
|
||||
I DEBUG ZWR MEDS
|
||||
N FDAIEN S FDAIEN=0 ; For use in $Order in the MEDS array.
|
||||
S MEDMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP"))
|
||||
S MEDMAP=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
|
||||
N MEDCOUNT S MEDCOUNT=@MEDMAP@(0) ; We already have meds in the array
|
||||
N MEDFIRST S MEDFIRST=1 ; FLAG FOR FIRST MED PROCESSED HERE
|
||||
F S FDAIEN=$O(MEDS(FDAIEN)) Q:FDAIEN="" D ; FOR EACH MEDICATION IN THE LIST
|
||||
. N MED M MED=MEDS(FDAIEN)
|
||||
. I MED(5,"I")!MED(6,"I") QUIT ; If disconinued, we don't want to pull it.
|
||||
. S MEDCOUNT=MEDCOUNT+1
|
||||
. S MAP=$NA(^TMP("GPLCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. S MAP=$NA(^TMP("C0CCCR",$J,"MEDMAP",MEDCOUNT))
|
||||
. S @MEDMAP@(0)=@MEDMAP@(0)+1 ; INCREMENT TOTAL MEDS IN VAR ARRAY
|
||||
. N RXIEN S RXIEN=$P(FDAIEN,",") ; First piece of FDAIEN is the number of the med for this patient
|
||||
. I DEBUG W "RXIEN IS ",RXIEN,!
|
||||
|
@ -202,27 +202,27 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template
|
|||
. . S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=MED(14,1) ; WP Field
|
||||
. E S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=""
|
||||
. S @MAP@("MEDRFNO")=""
|
||||
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
||||
. N RESULT S RESULT=$NA(^TMP("C0CCCR",$J,"MAPPED"))
|
||||
. K @RESULT
|
||||
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^GPLXPATH(RESULT)
|
||||
. D MAP^C0CXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^C0CXPATH(RESULT)
|
||||
. ; MAPPING DIRECTIONS
|
||||
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
|
||||
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
|
||||
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. D QUERY^C0CXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^C0CXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. ; N MDZ1,MDZNA
|
||||
. I DIRCNT>0 D ; IF THERE ARE DIRCTIONS
|
||||
. . F MDZ1=1:1:DIRCNT D ; FOR EACH DIRECTION
|
||||
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",MDZ1))
|
||||
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^GPLXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. . . D MAP^C0CXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. 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
|
||||
. . D CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER XML
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^GPLXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
. W "MEDICATION MISSING ",!
|
||||
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
|
||||
|
|
24
p/CCRMEDS6.m
24
p/CCRMEDS6.m
|
@ -57,12 +57,12 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
; I won't be using those because I have to get the sig parsed exactly.
|
||||
N J S J="" F S J=$O(MEDS1(J)) Q:J="" I $E(MEDS1(J),1,3)="~OP" S MEDCNT=MEDCNT+1 S MEDS(MEDCNT)=MEDS1(J)
|
||||
K MEDS1
|
||||
S MEDMAP=$NA(^TMP("GPLCCR",$J,"MEDMAP")) ; this is the variable map
|
||||
S MEDMAP=$NA(^TMP("C0CCCR",$J,"MEDMAP")) ; this is the variable map
|
||||
S @MEDMAP@(0)=0 ; Initial count of meds
|
||||
S MEDCNT="" ; Initialize for $Order
|
||||
F S MEDCNT=$O(MEDS(MEDCNT)) Q:MEDCNT="" D ; for each medication in the list
|
||||
. I DEBUG W "MEDCNT IS ",MEDCNT,!
|
||||
. S MAP=$NA(^TMP("GPLCCR",$J,"MEDMAP",MEDCNT))
|
||||
. S MAP=$NA(^TMP("C0CCCR",$J,"MEDMAP",MEDCNT))
|
||||
. ; K @MAP DO NOT KILL HERE, WAS CLEARED IN CCRMEDS
|
||||
. S @MEDMAP@(0)=@MEDMAP@(0)+1 ; increment total meds in var array
|
||||
. I DEBUG W "MAP= ",MAP,!
|
||||
|
@ -273,26 +273,26 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
|
|||
. ; ------ END OF MAPPING
|
||||
. ;
|
||||
. ; ------ BEGIN XML INSERTION
|
||||
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
|
||||
. N RESULT S RESULT=$NA(^TMP("C0CCCR",$J,"MAPPED"))
|
||||
. K @RESULT
|
||||
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^GPLXPATH(RESULT)
|
||||
. D MAP^C0CXPATH(MINXML,MAP,RESULT)
|
||||
. ; D PARY^C0CXPATH(RESULT)
|
||||
. ; MAPPING DIRECTIONS
|
||||
. N MEDDIR1,DIRXML1 S DIRXML1="MEDDIR1" ; VARIABLE AND NAME VARIABLE TEMPLATE
|
||||
. N MEDDIR2,DIRXML2 S DIRXML2="MEDDIR2" ; VARIABLE AND NAME VARIABLE RESULT
|
||||
. D QUERY^GPLXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^GPLXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. D QUERY^C0CXPATH(MINXML,"//Medications/Medication/Directions",DIRXML1)
|
||||
. D REPLACE^C0CXPATH(RESULT,"","//Medications/Medication/Directions")
|
||||
. ; N MDZ1,MDZNA
|
||||
. N DIRCNT S DIRCNT=""
|
||||
. I +$O(@MAP@("M","DIRECTIONS",DIRCNT)) D ; IF THERE ARE DIRCTIONS
|
||||
. . F DIRCNT=$O(@MAP@("M","DIRECTIONS",DIRCNT)) D ; FOR EACH DIRECTION
|
||||
. . . S MDZNA=$NA(@MAP@("M","DIRECTIONS",DIRCNT))
|
||||
. . . D MAP^GPLXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^GPLXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. D:MEDCNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:MEDCNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
|
||||
. . . D MAP^C0CXPATH(DIRXML1,MDZNA,DIRXML2)
|
||||
. . . D INSERT^C0CXPATH(RESULT,DIRXML2,"//Medications/Medication")
|
||||
. D:MEDCNT=1 CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:MEDCNT>1 INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^GPLXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
. W "MEDICATION MISSING ",!
|
||||
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
|
||||
|
|
Loading…
Reference in New Issue