modifications to clean up temp storage after processing
This commit is contained in:
parent
768e61605d
commit
30420e775a
15
p/C0CCCR.m
15
p/C0CCCR.m
|
@ -40,7 +40,7 @@ XPAT(DFN,XPARMS,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
|
|||
I '$D(XPARMS) S XPARMS=""
|
||||
N C0CRTN ; RETURN ARRAY
|
||||
D CCRRPC(.C0CRTN,DFN,XPARMS,"CCR")
|
||||
S OARY=$NA(^TMP("C0CCCR",$J,DFN,"CCR",1))
|
||||
S OARY=$NA(^TMP("C0CCUR",$J,DFN,"CCR",1))
|
||||
S ONAM=UFN
|
||||
I UFN="" S ONAM="PAT_"_DFN_"_CCR_V1_0_0.xml"
|
||||
S ODIRGLB=$NA(^TMP("C0CCCR","ODIR"))
|
||||
|
@ -61,7 +61,7 @@ XPAT(DFN,XPARMS,DIR,FN) ; EXPORT ONE PATIENT TO A FILE
|
|||
DCCR(DFN) ; DISPLAY A CCR THAT HAS JUST BEEN EXTRACTED
|
||||
;
|
||||
N G1
|
||||
S G1=$NA(^TMP("C0CCCR",$J,DFN,"CCR"))
|
||||
S G1=$NA(^TMP("C0CCUR",$J,DFN,"CCR"))
|
||||
I $D(@G1@(0)) D ; CCR EXISTS
|
||||
. D PARY^C0CXPATH(G1)
|
||||
E W "CCR NOT CREATED, RUN D XPAT^C0CCCR(DFN,"""","""") FIRST",!
|
||||
|
@ -77,6 +77,8 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
|
|||
; EXAMPLE: "LABLIMIT:T-60" TO LIMIT LAB EXTRACTION TO THE LAST 60 DAYS
|
||||
; SEE C0CPARMS FOR A COMPLETE LIST OF SUPPORTED PARAMETERS
|
||||
K ^TMP("C0CCCR",$J) ; CLEAN UP THE GLOBAL BEFORE WE USE IT
|
||||
M ^TMP("C0CSAV",$J)=^TMP($J) ; SAVING CALLER'S TMP SETTINGS
|
||||
K ^TMP($J) ; START CLEAN
|
||||
I '$D(DEBUG) S DEBUG=0
|
||||
S CCD=0 ; NEED THIS FLAG TO DISTINGUISH FROM CCD
|
||||
I '$D(CCRPARMS) S CCRPARMS=""
|
||||
|
@ -88,7 +90,7 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
|
|||
I '$D(TESTALERT) S TESTALERT=1 ; FLAG FOR TESTING ALERTS SECTION
|
||||
I '$D(TESTMEDS) S TESTMEDS=0 ; FLAG FOR TESTING C0CMED SECTION
|
||||
S TGLOBAL=$NA(^TMP("C0CCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
|
||||
S CCRGLO=$NA(^TMP("C0CCCR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
|
||||
S CCRGLO=$NA(^TMP("C0CCUR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
|
||||
S ACTGLO=$NA(^TMP("C0CCCR",$J,DFN,"ACTORS")) ; GLOBAL FOR ALL ACTORS
|
||||
; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
|
||||
;M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART OR ALL
|
||||
|
@ -141,9 +143,12 @@ CCRRPC(CCRGRTN,DFN,CCRPARMS,CCRPART) ;RPC ENTRY POINT FOR CCR OUTPUT
|
|||
. I DEBUG W "TRIMMED",J,!
|
||||
. I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE
|
||||
;S CCRGRTN=$NA(^TMP("C0CCCR",$J,DFN,CCRPART)) ; RTN GLOBAL OF PART OR ALL
|
||||
M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART OR ALL
|
||||
I CCRPART="CCR" M CCRGRTN=@CCRGLO ; ENTIRE CCR
|
||||
E M CCRGRTN=^TMP("C0CCCR",$J,DFN,CCRPART) ; RTN GLOBAL OF PART
|
||||
I '$D(C0CNRPC) S ^TMP("C0CRPC",$H,"RESULT",CCRGRTN(0))=""
|
||||
;K ^TMP("C0CCCR",$J) ; BEGIN TO CLEAN UP
|
||||
K ^TMP("C0CCCR",$J) ; BEGIN TO CLEAN UP
|
||||
K ^TMP($J) ; REALLY CLEAN UP
|
||||
M ^TMP($J)=^TMP("C0CSAV",$J) ; RESTORE CALLER'S $J
|
||||
Q
|
||||
;
|
||||
INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
|
||||
|
|
|
@ -75,6 +75,7 @@ VISTA
|
|||
N HIST S HIST=$NA(^TMP($J,"MED","HIST")) ; Meds already dispensed
|
||||
N PEND S PEND=$NA(^TMP($J,"MED","PEND")) ; Pending Meds
|
||||
N NVA S NVA=$NA(^TMP($J,"MED","NVA")) ; non-VA Meds
|
||||
K @HIST K @PEND K @NVA ; MAKE SURE THEY ARE EMPTY
|
||||
S @HIST@(0)=0,@PEND@(0)=0,@NVA@(0)=0 ; At first, they are all empty... (prevent undefined errors)
|
||||
; N IPIV ; Inpatient IV Meds
|
||||
; N IPUD ; Inpatient UD Meds
|
||||
|
@ -93,5 +94,12 @@ VISTA
|
|||
. I @HIST@(0)>0!(@PEND@(0)>0) D INSINNER^C0CXPATH(MEDOUTXML,NVA)
|
||||
. E D CP^C0CXPATH(NVA,MEDOUTXML)
|
||||
. W:$G(DEBUG) "HAS NON-VA MEDS",!
|
||||
N ZI
|
||||
S ZI=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
|
||||
M ^TMP("C0CRIM","VARS",DFN,"MEDS")=@ZI ; PERSIST MEDS VARIABLES
|
||||
K @ZI ; CLEAN UP MED MAP AFTER - GPL 10/10
|
||||
K @PEND
|
||||
K @HIST
|
||||
K @NVA
|
||||
Q
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; EXTRACT MEDICATIONS INTO PROVIDE
|
|||
. I MEDFIRST D ;
|
||||
. . S MEDFIRST=0 ; RESET FIRST FLAG
|
||||
. . D CP^C0CXPATH(RESULT,OUTXML) ; First one is a copy
|
||||
. D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER XML
|
||||
. D:'MEDFIRST INSINNER^C0CXPATH(OUTXML,RESULT) ; AFTER FIRST, INSERT INNER
|
||||
N MEDTMP,MEDI
|
||||
D MISSING^C0CXPATH(OUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
|
||||
|
|
|
@ -104,6 +104,9 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; Extract medications into provided xml temp
|
|||
. . . M NDFDATA=^TMP($J,"NDF",MEDIEN)
|
||||
. . . S NDFIEN=$P(NDFDATA(20),U)
|
||||
. . . S VAPROD=$P(NDFDATA(22),U)
|
||||
. . . S @MAP@("MEDPRODUCTNAMETEXT")=$$GET1^DIQ(50.68,VAPROD,.01) ;
|
||||
. . ; GPL - RESET THE NAME TO THE REAL NAME OF THE DRUG NOW THAT WE
|
||||
. . ; HAVE IT.
|
||||
. . ;
|
||||
. . ; NDFIEN is not necessarily defined; it won't be if the drug
|
||||
. . ; is not matched to the national drug file (e.g. if the drug is
|
||||
|
@ -255,8 +258,5 @@ EXTRACT(MINXML,DFN,OUTXML,MEDCOUNT) ; Extract medications into provided xml temp
|
|||
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),!
|
||||
N ZI
|
||||
S ZI=$NA(^TMP("C0CCCR",$J,"MEDMAP"))
|
||||
M ^TMP("C0CRIM","VARS",DFN,"MEDS")=@ZI ; PERSIST MEDS VARIABLES
|
||||
Q
|
||||
;
|
||||
|
|
|
@ -23,7 +23,7 @@ SET(INPARMS) ;INITIALIZE RUNTIME PARMS USING INPARMS TO OVERRIDE DEFAULTS
|
|||
;
|
||||
N PTMP ;
|
||||
S C0CPARMS=$NA(^TMP("C0CPARMS",$J)) ;BASE FOR THIS RUN
|
||||
;K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
|
||||
K @C0CPARMS ;START WITH EMPTY PARMS; MAY NOT WANT TO DO THIS KILL
|
||||
I $G(INPARMS)'="" D ; OVERRIDES PROVIDED
|
||||
. N C0CI S C0CI=""
|
||||
. N C0CN S C0CN=1
|
||||
|
|
Loading…
Reference in New Issue