94 lines
3.6 KiB
Mathematica
94 lines
3.6 KiB
Mathematica
|
GPLCCR ; CCDCCR/GPL - CCR MAIN PROCESSING; 6/6/08
|
||
|
;;0.1;CCDCCR;nopatch;noreleasedate
|
||
|
;
|
||
|
; EXPORT A CCR
|
||
|
;
|
||
|
EXPORT ; EXPORT ENTRY POINT FOR CCR
|
||
|
; would like to call fileman routine here to select a patient
|
||
|
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"
|
||
|
S ODIR="/home/wvehr3/EHR/CCR"
|
||
|
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
|
||
|
. ; D INSERT^GPLXPATH(CCRGLO,OXML,"//ContinuityOfCareRecord/Body")
|
||
|
. I DEBUG F GPLI=1:1:@OXML@(0) W @OXML@(GPLI),!
|
||
|
. 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)
|
||
|
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>
|