2008-06-21 17:55:44 -04:00
|
|
|
GPLCCR ; CCDCCR/GPL - CCR MAIN PROCESSING; 6/6/08
|
|
|
|
;;0.1;CCDCCR;nopatch;noreleasedate
|
|
|
|
;
|
|
|
|
; EXPORT A CCR
|
|
|
|
;
|
|
|
|
EXPORT ; EXPORT ENTRY POINT FOR CCR
|
2008-06-22 00:20:02 -04:00
|
|
|
; Select a patient for real.
|
2008-06-21 17:55:44 -04:00
|
|
|
S DIC=2,DIC(0)="AEMQ" D ^DIC
|
|
|
|
S DFN=$P(Y,U,1) ; SET THE PATIENT
|
|
|
|
N CCRGLO
|
|
|
|
D CCRRPC(.CCRGLO,DFN,"CCR")
|
|
|
|
S OARY=$NA(^TMP($J,DFN,"CCR",1))
|
|
|
|
S ONAM="PAT_"_DFN_"_CCR_V1.xml"
|
2008-06-30 14:21:04 -04:00
|
|
|
S ODIR="/home/glilly/CCROUT"
|
2008-06-21 17:55:44 -04:00
|
|
|
D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
|
|
|
|
Q
|
|
|
|
;
|
|
|
|
CCRRPC(CCRGRTN,DFN,CCRPART) ; RPC ENTRY POINT FOR CCR OUTPUT
|
|
|
|
S DEBUG=0
|
|
|
|
S TGLOBAL=$NA(^TMP($J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
|
|
|
|
S CCRGLO=$NA(^TMP($J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
|
|
|
|
; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
|
|
|
|
S CCRGRTN=$NA(^TMP($J,DFN,CCRPART)) ; RTN GLO NM OF PART OR ALL OF CCR
|
|
|
|
D LOAD^GPLCCR0(TGLOBAL) ; LOAD THE CCR TEMPLATE
|
|
|
|
D CP^GPLXPATH(TGLOBAL,CCRGLO) ; COPY THE TEMPLATE TO THE CCR GLOBAL
|
|
|
|
;
|
|
|
|
; DELETE THE BODY, ACTORS AND SIGNATURES SECTIONS FROM THE CCR GLOBAL
|
|
|
|
; THESE WILL BE POPULATED WITH CALLS TO THE XPATH PROCESSING ROUTINES
|
|
|
|
D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Body")
|
|
|
|
D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Actors")
|
|
|
|
D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Signatures")
|
|
|
|
F I=1:1:@CCRGLO@(0) W @CCRGLO@(I),!
|
|
|
|
;
|
|
|
|
S CCRXTAB="^TMP($J,""CCRSTEP"")" ; GLOBAL TO STORE CCR PROCESSING STEPS
|
|
|
|
D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
|
|
|
|
N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
|
|
|
|
F I=1:1:@CCRXTAB@(0) D ; PROCESS THE CCR BODY SECTIONS
|
|
|
|
. S XI=@CCRXTAB@(I) ; CALL COPONENTS TO PARSE
|
|
|
|
. S RTN=$P(XI,";",2) ; NAME OF ROUTINE TO CALL
|
|
|
|
. S TAG=$P(XI,";",1) ; LABEL INSIDE ROUTINE TO CALL
|
|
|
|
. S XPATH=$P(XI,";",3) ; XPATH TO XML TO PASS TO ROUTINE
|
|
|
|
. D QUERY^GPLXPATH(TGLOBAL,XPATH,"INXML") ; EXTRACT XML TO PASS
|
|
|
|
. S IXML="INXML"
|
|
|
|
. S OXML=$P(XI,";",4) ; ARRAY FOR SECTION VALUES
|
|
|
|
. ; W OXML,!
|
|
|
|
. S CALL="D "_TAG_"^"_RTN_"(IXML,DFN,OXML)" ; SETUP THE CALL
|
|
|
|
. W "RUNNING ",CALL,!
|
|
|
|
. X CALL
|
|
|
|
. ; NOW INSERT THE RESULTS IN THE CCR BUFFER
|
2008-06-26 13:51:24 -04:00
|
|
|
. D INSERT^GPLXPATH(CCRGLO,OXML,"//ContinuityOfCareRecord/Body")
|
2008-06-21 17:55:44 -04:00
|
|
|
. I DEBUG F GPLI=1:1:@OXML@(0) W @OXML@(GPLI),!
|
2008-06-26 13:51:24 -04:00
|
|
|
. ; D QOPEN^GPLXPATH("CCRBLD",CCRGLO,"//ContinuityOfCareRecord/Body")
|
|
|
|
. ; D QUEUE^GPLXPATH("CCRBLD",OXML,1,@OXML@(0))
|
|
|
|
. ; D QCLOSE^GPLXPATH("CCRBLD",CCRGLO,"//ContinuityOfCareRecord/Body")
|
|
|
|
. ; I DEBUG W "GOING TO BUILD CCR",!
|
|
|
|
. ; N CCRTMP
|
|
|
|
. ; D BUILD^GPLXPATH("CCRBLD","CCRTMP")
|
|
|
|
. ; I DEBUG F GPLI=1:1:CCRTMP(0) W CCRTMP(GPLI),!
|
|
|
|
. ; D CP^GPLXPATH("CCRTMP",CCRGLO)
|
2008-06-21 17:55:44 -04:00
|
|
|
Q
|
|
|
|
;
|
|
|
|
INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
|
|
|
|
; TAB IS PASSED BY NAME
|
|
|
|
; W "TAB= ",TAB,!
|
|
|
|
; D PUSH^GPLXPATH(TAB,"EXTRACT;GPLVITALS;//ContinuityOfCareRecord/Body/VitalSigns;^TMP($J,DFN,""VITALS"")")
|
|
|
|
D PUSH^GPLXPATH(TAB,"EXTRACT;GPLPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP($J,DFN,""PROBLEMS"")")
|
|
|
|
Q
|
|
|
|
;
|
|
|
|
TEST ; RUN ALL THE TEST CASES
|
|
|
|
N ZTMP
|
|
|
|
D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
|
|
|
|
D ZTEST^GPLUNIT(.ZTMP,"ALL")
|
|
|
|
W !
|
|
|
|
; W "THE TESTS!",!
|
|
|
|
; ZWR ZTMP
|
|
|
|
Q
|
|
|
|
;
|
|
|
|
ZTEST(WHICH) ; RUN ONE SET OF TESTS
|
|
|
|
N ZTMP
|
|
|
|
D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
|
|
|
|
D ZTEST^GPLUNIT(.ZTMP,WHICH)
|
|
|
|
Q
|
|
|
|
;
|
|
|
|
TLIST ; LIST THE TESTS
|
|
|
|
N ZTMP
|
|
|
|
D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
|
|
|
|
D TLIST^GPLUNIT(.ZTMP)
|
|
|
|
Q
|
|
|
|
;
|
|
|
|
;;><TEST>
|
|
|
|
;;><INIT>
|
|
|
|
;;>>>K GPL S GPL=""
|
|
|
|
;;></TEST>
|