source: ccr/trunk/p/C0CPROBS.m@ 547

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

formatting for Version 1

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