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

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

improvements to Problems and Alerts, added dates, type

File size: 4.9 KB
Line 
1GPLPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
2 ;;0.1;CCDCCR;nopatch;noreleasedate;Build 7
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 I '$T(GET^BGOPRB) D ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
36 . D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
37 E D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
38 I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
39 . W "NULL RESULT FROM LIST^ORQQPL3 ",!
40 . S @OUTXML@(0)=0
41 . ; Q
42 ; I DEBUG ZWR RPCRSLT
43 S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
44 F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
45 . S VMAP=$NA(@TVMAP@(J))
46 . K @VMAP
47 . I DEBUG W "VMAP= ",VMAP,!
48 . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
49 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
50 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
51 . S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,2)="A":"Active",1:"")
52 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
53 . S @VMAP@("PROBLEMCODINGVERSION")=""
54 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
55 . S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^CCRUTIL($P(PTMP,U,5),"DT")
56 . S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^CCRUTIL($P(PTMP,U,6),"DT")
57 . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
58 . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
59 . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
60 . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
61 . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
62 . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
63 . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
64 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
65 . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
66 . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
67 . S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^CCRUTIL($P(PTMP,U,15),"DT")
68 . S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^CCRUTIL($P(PTMP,U,16),"DT")
69 . S ARYTMP=$NA(@TARYTMP@(J))
70 . ; W "ARYTMP= ",ARYTMP,!
71 . K @ARYTMP
72 . D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
73 . I J=1 D ; FIRST ONE IS JUST A COPY
74 . . ; W "FIRST ONE",!
75 . . D CP^GPLXPATH(ARYTMP,OUTXML)
76 . . ; W "OUTXML ",OUTXML,!
77 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
78 . . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
79 ; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
80 ; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
81 ; ZWR @OUTXML
82 ; $$HTML^DILF(
83 ; GENERATE THE NARITIVE HTML FOR THE CCD
84 I CCD D ; IF THIS IS FOR A CCD
85 . N HTMP,HOUT,HTMLO,GPLPROBI,ZX
86 . F GPLPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
87 . . S VMAP=$NA(@TVMAP@(GPLPROBI))
88 . . I DEBUG W "VMAP =",VMAP,!
89 . . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
90 . . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
91 . . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
92 . . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
93 . . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
94 . . I GPLPROBI=1 D ; FIRST ONE IS JUST A COPY
95 . . . D CP^GPLXPATH("HOUT","HTMLO")
96 . . I GPLPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
97 . . . I DEBUG W "DOING INNER",!
98 . . . N HTMLBLD,HTMLTMP
99 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
100 . . . D QUEUE^GPLXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
101 . . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
102 . . . D BUILD^GPLXPATH("HTMLBLD","HTMLTMP")
103 . . . D CP^GPLXPATH("HTMLTMP","HTMLO")
104 . . . ; D INSINNER^GPLXPATH("HOUT","HTMLO","//")
105 . I DEBUG D PARY^GPLXPATH("HTMLO")
106 . D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
107 N PROBSTMP,I
108 D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
109 I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
110 . ; STRINGS MARKED AS @@X@@
111 . W !,"PROBLEMS Missing list: ",!
112 . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
113 Q
114 ;
Note: See TracBrowser for help on using the repository browser.