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

Last change on this file since 1746 was 1586, checked in by Sam Habiel, 12 years ago

Changed license to AGPL. Some clean-up for XINDEX

  • Property svn:mergeinfo set to (toggle deleted branches)
    /ccr/branches/ohum/o-old/p/C0CPROBS.m1290
    /ccr/branches/ohum/p/C0CPROBS.m1291-1543
    /ccr/branches/ohum/p/p/C0CPROBS.m1287-1289
File size: 8.1 KB
Line 
1C0CPROBS ; CCDCCR/GPL/CJE - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
2 ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
3 ;Copyright 2008,2009 George Lilly, University of Minnesota.
4 ;
5 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU Affero General Public License as
7 ; published by the Free Software Foundation, either version 3 of the
8 ; License, or (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU Affero General Public License for more details.
14 ;
15 ; You should have received a copy of the GNU Affero General Public License
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ;
18 ; PROCESS THE PROBLEMS SECTION OF THE CCR
19 ;
20EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
21 ;
22 ; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
23 ; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
24 ; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
25 ; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
26 ; INSERT^C0CXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
27 ;
28 N RPCRSLT,J,K,PTMP,X,VMAP,TBU
29 S TVMAP=$NA(^TMP("C0CCCR",$J,"PROBVALS"))
30 S TARYTMP=$NA(^TMP("C0CCCR",$J,"PROBARYTMP"))
31 K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
32 I $$RPMS^C0CUTIL() D RPMS ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
33 I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
34 Q
35 ;
36RPMS ; GETS THE PROBLEM LIST FOR RPMS
37 S RPCGLO=$NA(^TMP("BGO",$J))
38 D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
39 ; FORMAT OF RPC:
40 ; Number Code [1] ^ Patient IEN [2] ^ ICD Code [3] ^ Modify Date [4] ^ Class [5] ^ Provider Narrative [6] ^
41 ; Date Entered [7] ^ Status [8] ^ Date Onset [9] ^ Problem IEN [10] ^ Notes [11] ^ ICD9 IEN [12] ^
42 ; ICD9 Short Name [13] ^ Provider [14] ^ Facility IEN [15] ^ Priority [16]
43 I '$D(@RPCGLO) W "NULL RESULT FROM GET^BGOPROB ",! S @OUTXML@(0)=0 Q
44 S J=""
45 F S J=$O(@RPCGLO@(J)) Q:J="" 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 . N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
51 . D GETN1^C0CRNF("C0CG1",9000011,$P(PTMP,U,10),"") ;GET VALUES BY NAME
52 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
53 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,10)
54 . S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,8)="A":"Active",$P(PTMP,U,8)="I":"Inactive",1:"")
55 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,6)
56 . S @VMAP@("PROBLEMCODINGVERSION")=""
57 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,3)
58 . ; FOR CERTIFICATION - GPL
59 . I @VMAP@("PROBLEMCODEVALUE")=493.90 S @VMAP@("PROBLEMCODEVALUE")=493
60 . S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE OF ONSET","C0CG1"),"DT")
61 . S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE LAST MODIFIED","C0CG1"),"DT")
62 . ;S @VMAP@("PROBLEMSC")=$P(PTMP,U,7) ;UNKNOWN NOT MAPPED IN C0CCCR0
63 . ;S @VMAP@("PROBLEMSE")=$P(PTMP,U,8) ;UNKNOWN NOT MAPPED IN C0CCCR0
64 . ;S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9) ;NOT MAPPED IN C0CCCR0
65 . ;S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10) ;NOT MAPPED IN C0CCCR0
66 . ;S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11) ;NOT MAPPED IN C0CCCR0
67 . ;S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12) ;NOT MAPPED IN C0CCCR0
68 . ;S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
69 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$$ZVALUEI^C0CRNF("RECORDING PROVIDER","C0CG1")
70 . ;S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13) ;NOT MAPPED IN C0CCCR0
71 . ;S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14) ;NOT MAPPED IN C0CCCR0
72 . ;S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT") ;NOT MAPPED IN C0CCCR0
73 . ;S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT") ;NOT MAPPED IN C0CCCR0
74 . S ARYTMP=$NA(@TARYTMP@(J))
75 . ; W "ARYTMP= ",ARYTMP,!
76 . K @ARYTMP
77 . D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
78 . I J=1 D ; FIRST ONE IS JUST A COPY
79 . . ; W "FIRST ONE",!
80 . . D CP^C0CXPATH(ARYTMP,OUTXML)
81 . . ; W "OUTXML ",OUTXML,!
82 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
83 . . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
84 ; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
85 ; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
86 ; ZWR @OUTXML
87 ; $$HTML^DILF(
88 ; GENERATE THE NARITIVE HTML FOR THE CCD
89 I CCD D CCD ; IF THIS IS FOR A CCD
90 D MISSVARS
91 Q
92 ;
93VISTA ; GETS THE PROBLEM LIST FOR VISTA
94 D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
95 I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
96 . W "NULL RESULT FROM LIST^ORQQPL3 ",!
97 . S @OUTXML@(0)=0
98 . ; Q
99 ; I DEBUG ZWR RPCRSLT
100 S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
101 F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
102 . S VMAP=$NA(@TVMAP@(J))
103 . K @VMAP
104 . I DEBUG W "VMAP= ",VMAP,!
105 . S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
106 . S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
107 . S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
108 . S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,2)="A":"Active",$P(PTMP,U,2)="I":"Inactive",1:"")
109 . N ZPRIOR S ZPRIOR=$P(PTMP,U,14) ;PRIORITY FLAG
110 . ; turn off acute/chronic for certification gpl
111 . ;S @VMAP@("PROBLEMSTATUS")=@VMAP@("PROBLEMSTATUS")_$S(ZPRIOR="A":"/Acute",ZPRIOR="C":"/Chronic",1:"") ; append Chronic and Accute to Status
112 . S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
113 . S @VMAP@("PROBLEMCODINGVERSION")=""
114 . S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
115 . ; FOR CERTIFICATION - GPL
116 . I @VMAP@("PROBLEMCODEVALUE")["493.90" S @VMAP@("PROBLEMCODEVALUE")=493
117 . S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,5),"DT")
118 . S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,6),"DT")
119 . S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
120 . S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
121 . S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
122 . S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
123 . S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
124 . S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
125 . S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
126 . S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
127 . S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
128 . S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
129 . S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT")
130 . S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT")
131 . S ARYTMP=$NA(@TARYTMP@(J))
132 . ; W "ARYTMP= ",ARYTMP,!
133 . K @ARYTMP
134 . D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
135 . I J=1 D ; FIRST ONE IS JUST A COPY
136 . . ; W "FIRST ONE",!
137 . . D CP^C0CXPATH(ARYTMP,OUTXML)
138 . . ; W "OUTXML ",OUTXML,!
139 . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
140 . . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
141 ; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
142 ; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
143 ; ZWR @OUTXML
144 ; $$HTML^DILF(
145 ; GENERATE THE NARITIVE HTML FOR THE CCD
146 I CCD D CCD ; IF THIS IS FOR A CCD
147 D MISSVARS
148 Q
149CCD ;
150 N HTMP,HOUT,HTMLO,C0CPROBI,ZX
151 F C0CPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
152 . S VMAP=$NA(@TVMAP@(C0CPROBI))
153 . I DEBUG W "VMAP =",VMAP,!
154 . D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
155 . D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
156 . ; D PARY^C0CXPATH("HTMP") ; PRINT IT
157 . D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
158 . ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
159 . I C0CPROBI=1 D ; FIRST ONE IS JUST A COPY
160 . . D CP^C0CXPATH("HOUT","HTMLO")
161 . I C0CPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
162 . . I DEBUG W "DOING INNER",!
163 . . N HTMLBLD,HTMLTMP
164 . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
165 . . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
166 . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
167 . . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
168 . . D CP^C0CXPATH("HTMLTMP","HTMLO")
169 . . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
170 I DEBUG D PARY^C0CXPATH("HTMLO")
171 D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
172 Q
173MISSVARS ; Missing Variables
174 N PROBSTMP,I
175 D MISSING^C0CXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
176 I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
177 . ; STRINGS MARKED AS @@X@@
178 . W !,"PROBLEMS Missing list: ",!
179 . F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
180 Q
181 ;
Note: See TracBrowser for help on using the repository browser.