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

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

moved CCD Problems HTML narrative to the template

File size: 4.7 KB
RevLine 
[3]1GPLPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
[60]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 ;
[40]20 ;
21 ; PROCESS THE PROBLEMS SECTION OF THE CCR
22 ;
[3]23EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
[40]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,TBUF
32 D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
33 I '$D(RPCRSLT(0)) W "ERROR CALLING LIST^ORQQPL3 ",! Q
34 ZWR RPCRSLT
[50]35 S TVMAP=$NA(^TMP("GPLCCR",$J,"PROBVALS"))
36 S TARYTMP=$NA(^TMP("GPLCCR",$J,"PROBARYTMP"))
[40]37 F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
38 . S VMAP=$NA(@TVMAP@(J))
39 . K @VMAP
40 . I DEBUG W "VMAP= ",VMAP,!
41 . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
42 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
43 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
44 . S @VMAP@("PROBLEMSTATUS")=$P(PTMP,U,2)
45 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
46 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
47 . S @VMAP@("PROBLEMDATEOFONSET")=$P(PTMP,U,5)
48 . S @VMAP@("PROBLEMDATEMOD")=$P(PTMP,U,6)
49 . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
50 . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
51 . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
52 . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
53 . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
54 . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
55 . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
56 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
57 . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
58 . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
59 . S @VMAP@("PROBLEMDTREC")=$P(PTMP,U,15)
60 . S @VMAP@("PROBLEMINACT")=$P(PTMP,U,16)
61 . S ARYTMP=$NA(@TARYTMP@(J))
62 . ; W "ARYTMP= ",ARYTMP,!
63 . K @ARYTMP
64 . D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
65 . I J=1 D ; FIRST ONE IS JUST A COPY
66 . . ; W "FIRST ONE",!
67 . . D CP^GPLXPATH(ARYTMP,OUTXML)
68 . . ; W "OUTXML ",OUTXML,!
69 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
70 . . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
[50]71 ; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
72 ; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
[40]73 ; ZWR @OUTXML
74 ; $$HTML^DILF(
[76]75 ; GENERATE THE NARITIVE HTML FOR THE CCD
76 I CCD D ; IF THIS IS FOR A CCD
[85]77 . N HTMP,HOUT,HTMLO,I,ZX
[76]78 . F I=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
79 . . S VMAP=$NA(@TVMAP@(I))
[85]80 . . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
81 . . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
82 . . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
83 . . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
84 . . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
85 . . I I=1 D ; FIRST ONE IS JUST A COPY
86 . . . D CP^GPLXPATH("HOUT","HTMLO")
87 . . I I>1 D ; AFTER THE FIRST, INSERT INNER HTML
88 . . . D INSINNER^GPLXPATH("HOUT","HTMLO","//")
89 . D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
[40]90 N PROBSTMP,I
91 D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
[43]92 I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
93 . ; STRINGS MARKED AS @@X@@
[40]94 . W "PROBLEMS Missing list: ",!
95 . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
96 Q
97 ;
Note: See TracBrowser for help on using the repository browser.