source: ccr/trunk/p/GPLCCR.m@ 11

Last change on this file since 11 was 11, checked in by Sam Habiel, 16 years ago

testing

File size: 3.6 KB
Line 
1GPLCCR ; CCDCCR/GPL - CCR MAIN PROCESSING; 6/6/08
2 ;;0.1;CCDCCR;nopatch;noreleasedate
3 ;
4 ; EXPORT A CCR
5 ;
6EXPORT ; EXPORT ENTRY POINT FOR CCR
7 ; Select a patient for real.
8 S DIC=2,DIC(0)="AEMQ" D ^DIC
9 S DFN=$P(Y,U,1) ; SET THE PATIENT
10 N CCRGLO
11 D CCRRPC(.CCRGLO,DFN,"CCR")
12 S OARY=$NA(^TMP($J,DFN,"CCR",1))
13 S ONAM="PAT_"_DFN_"_CCR_V1.xml"
14 S ODIR="/home/glilly/CCROUT"
15 D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
16 Q
17 ;
18CCRRPC(CCRGRTN,DFN,CCRPART) ; RPC ENTRY POINT FOR CCR OUTPUT
19 S DEBUG=0
20 S TGLOBAL=$NA(^TMP($J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE
21 S CCRGLO=$NA(^TMP($J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR
22 ; TO GET PART OF THE CCR RETURNED, PASS CCRPART="PROBLEMS" ETC
23 S CCRGRTN=$NA(^TMP($J,DFN,CCRPART)) ; RTN GLO NM OF PART OR ALL OF CCR
24 D LOAD^GPLCCR0(TGLOBAL) ; LOAD THE CCR TEMPLATE
25 D CP^GPLXPATH(TGLOBAL,CCRGLO) ; COPY THE TEMPLATE TO THE CCR GLOBAL
26 ;
27 ; DELETE THE BODY, ACTORS AND SIGNATURES SECTIONS FROM THE CCR GLOBAL
28 ; THESE WILL BE POPULATED WITH CALLS TO THE XPATH PROCESSING ROUTINES
29 D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Body")
30 D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Actors")
31 D REPLACE^GPLXPATH(CCRGLO,"","//ContinuityOfCareRecord/Signatures")
32 F I=1:1:@CCRGLO@(0) W @CCRGLO@(I),!
33 ;
34 S CCRXTAB="^TMP($J,""CCRSTEP"")" ; GLOBAL TO STORE CCR PROCESSING STEPS
35 D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
36 N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
37 F I=1:1:@CCRXTAB@(0) D ; PROCESS THE CCR BODY SECTIONS
38 . S XI=@CCRXTAB@(I) ; CALL COPONENTS TO PARSE
39 . S RTN=$P(XI,";",2) ; NAME OF ROUTINE TO CALL
40 . S TAG=$P(XI,";",1) ; LABEL INSIDE ROUTINE TO CALL
41 . S XPATH=$P(XI,";",3) ; XPATH TO XML TO PASS TO ROUTINE
42 . D QUERY^GPLXPATH(TGLOBAL,XPATH,"INXML") ; EXTRACT XML TO PASS
43 . S IXML="INXML"
44 . S OXML=$P(XI,";",4) ; ARRAY FOR SECTION VALUES
45 . ; W OXML,!
46 . S CALL="D "_TAG_"^"_RTN_"(IXML,DFN,OXML)" ; SETUP THE CALL
47 . W "RUNNING ",CALL,!
48 . X CALL
49 . ; NOW INSERT THE RESULTS IN THE CCR BUFFER
50 . ; D INSERT^GPLXPATH(CCRGLO,OXML,"//ContinuityOfCareRecord/Body")
51 . I DEBUG F GPLI=1:1:@OXML@(0) W @OXML@(GPLI),!
52 . D QOPEN^GPLXPATH("CCRBLD",CCRGLO,"//ContinuityOfCareRecord/Body")
53 . D QUEUE^GPLXPATH("CCRBLD",OXML,1,@OXML@(0))
54 . D QCLOSE^GPLXPATH("CCRBLD",CCRGLO,"//ContinuityOfCareRecord/Body")
55 . I DEBUG W "GOING TO BUILD CCR",!
56 . N CCRTMP
57 . D BUILD^GPLXPATH("CCRBLD","CCRTMP")
58 . I DEBUG F GPLI=1:1:CCRTMP(0) W CCRTMP(GPLI),!
59 . D CP^GPLXPATH("CCRTMP",CCRGLO)
60 Q
61 ;
62INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
63 ; TAB IS PASSED BY NAME
64 ; W "TAB= ",TAB,!
65 ; D PUSH^GPLXPATH(TAB,"EXTRACT;GPLVITALS;//ContinuityOfCareRecord/Body/VitalSigns;^TMP($J,DFN,""VITALS"")")
66 D PUSH^GPLXPATH(TAB,"EXTRACT;GPLPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP($J,DFN,""PROBLEMS"")")
67 Q
68 ;
69TEST ; RUN ALL THE TEST CASES
70 N ZTMP
71 D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
72 D ZTEST^GPLUNIT(.ZTMP,"ALL")
73 W !
74 ; W "THE TESTS!",!
75 ; ZWR ZTMP
76 Q
77 ;
78ZTEST(WHICH) ; RUN ONE SET OF TESTS
79 N ZTMP
80 D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
81 D ZTEST^GPLUNIT(.ZTMP,WHICH)
82 Q
83 ;
84TLIST ; LIST THE TESTS
85 N ZTMP
86 D ZLOAD^GPLUNIT("ZTMP","GPLCCR")
87 D TLIST^GPLUNIT(.ZTMP)
88 Q
89 ;
90;;><TEST>
91;;><INIT>
92;;>>>K GPL S GPL=""
93;;></TEST>
Note: See TracBrowser for help on using the repository browser.