source: ccr/trunk/p/GPLPROBS.m@ 272

Last change on this file since 272 was 146, checked in by George Lilly, 16 years ago

enhancements to GPLRIMA to locate patients

File size: 5.5 KB
Line 
1GPLPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
2 ;;0.1;CCDCCR;nopatch;noreleasedate
3 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 ;
21 ; PROCESS THE PROBLEMS SECTION OF THE CCR
22 ;
23EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
24 ;
25 ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
26 ; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
27 ; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
28 ; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
29 ; INSERT^GPLXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
30 ;
31 N RPCRSLT,J,K,PTMP,X,VMAP,TBU
32 S TVMAP=$NA(^TMP("GPLCCR",$J,"PROBVALS"))
33 S TARYTMP=$NA(^TMP("GPLCCR",$J,"PROBARYTMP"))
34 K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
35 D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
36 I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
37 . W "NULL RESULT FROM LIST^ORQQPL3 ",!
38 . S @OUTXML@(0)=0
39 . ; Q
40 ; I DEBUG ZWR RPCRSLT
41 S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
42 F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
43 . S VMAP=$NA(@TVMAP@(J))
44 . K @VMAP
45 . I DEBUG W "VMAP= ",VMAP,!
46 . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
47 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
48 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
49 . S @VMAP@("PROBLEMSTATUS")=$P(PTMP,U,2)
50 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
51 . S @VMAP@("PROBLEMCODINGVERSION")=""
52 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
53 . S @VMAP@("PROBLEMDATEOFONSET")=$P(PTMP,U,5)
54 . S @VMAP@("PROBLEMDATEMOD")=$P(PTMP,U,6)
55 . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
56 . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
57 . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
58 . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
59 . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
60 . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
61 . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
62 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
63 . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
64 . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
65 . S @VMAP@("PROBLEMDTREC")=$P(PTMP,U,15)
66 . S @VMAP@("PROBLEMINACT")=$P(PTMP,U,16)
67 . S ARYTMP=$NA(@TARYTMP@(J))
68 . ; W "ARYTMP= ",ARYTMP,!
69 . K @ARYTMP
70 . D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
71 . I J=1 D ; FIRST ONE IS JUST A COPY
72 . . ; W "FIRST ONE",!
73 . . D CP^GPLXPATH(ARYTMP,OUTXML)
74 . . ; W "OUTXML ",OUTXML,!
75 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
76 . . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
77 ; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
78 ; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
79 ; ZWR @OUTXML
80 ; $$HTML^DILF(
81 ; GENERATE THE NARITIVE HTML FOR THE CCD
82 I CCD D ; IF THIS IS FOR A CCD
83 . N HTMP,HOUT,HTMLO,GPLPROBI,ZX
84 . F GPLPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
85 . . S VMAP=$NA(@TVMAP@(GPLPROBI))
86 . . I DEBUG W "VMAP =",VMAP,!
87 . . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
88 . . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
89 . . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
90 . . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
91 . . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
92 . . I GPLPROBI=1 D ; FIRST ONE IS JUST A COPY
93 . . . D CP^GPLXPATH("HOUT","HTMLO")
94 . . I GPLPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
95 . . . I DEBUG W "DOING INNER",!
96 . . . N HTMLBLD,HTMLTMP
97 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
98 . . . D QUEUE^GPLXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
99 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
100 . . . D BUILD^GPLXPATH("HTMLBLD","HTMLTMP")
101 . . . D CP^GPLXPATH("HTMLTMP","HTMLO")
102 . . . ; D INSINNER^GPLXPATH("HOUT","HTMLO","//")
103 . I DEBUG D PARY^GPLXPATH("HTMLO")
104 . D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
105 N PROBSTMP,I
106 D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
107 I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
108 . ; STRINGS MARKED AS @@X@@
109 . W !,"PROBLEMS Missing list: ",!
110 . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
111 Q
112 ;
Note: See TracBrowser for help on using the repository browser.