2008-06-21 17:55:44 -04:00
|
|
|
GPLPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
2008-07-14 10:53:09 -04:00
|
|
|
;;0.1;CCDCCR;nopatch;noreleasedate
|
|
|
|
;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
|
|
|
|
;General Public License See attached copy of the License.
|
|
|
|
;
|
|
|
|
;This program is free software; you can redistribute it and/or modify
|
|
|
|
;it under the terms of the GNU General Public License as published by
|
|
|
|
;the Free Software Foundation; either version 2 of the License, or
|
|
|
|
;(at your option) any later version.
|
|
|
|
;
|
|
|
|
;This program is distributed in the hope that it will be useful,
|
|
|
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
;You should have received a copy of the GNU General Public License along
|
|
|
|
;with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
;
|
2008-07-03 21:02:47 -04:00
|
|
|
;
|
|
|
|
; PROCESS THE PROBLEMS SECTION OF THE CCR
|
|
|
|
;
|
2008-06-21 17:55:44 -04:00
|
|
|
EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
2008-07-03 21:02:47 -04:00
|
|
|
;
|
|
|
|
; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
|
|
|
; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
|
|
|
|
; ONLY THE XML FOR ONE PROBLEM WILL BE PASSED. THIS ROUTINE WILL MAKE
|
|
|
|
; COPIES AS NECESSARY TO REPRESENT MULTIPLE PROBLEMS
|
|
|
|
; INSERT^GPLXPATH IS USED TO APPEND THE PROBLEMS TO THE OUTPUT
|
|
|
|
;
|
2008-08-26 20:27:36 -04:00
|
|
|
N RPCRSLT,J,K,PTMP,X,VMAP,TBU
|
|
|
|
S TVMAP=$NA(^TMP("GPLCCR",$J,"PROBVALS"))
|
|
|
|
S TARYTMP=$NA(^TMP("GPLCCR",$J,"PROBARYTMP"))
|
|
|
|
K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
|
2009-01-06 12:07:27 -05:00
|
|
|
I $D(^TMP("GPLCCR","RPMS")) D ; IF IN RPMS
|
|
|
|
. D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
|
|
|
|
E D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
|
2008-08-30 13:29:46 -04:00
|
|
|
I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
|
2008-08-12 13:37:18 -04:00
|
|
|
. W "NULL RESULT FROM LIST^ORQQPL3 ",!
|
|
|
|
. S @OUTXML@(0)=0
|
2008-08-14 12:24:07 -04:00
|
|
|
. ; Q
|
2008-08-30 15:13:15 -04:00
|
|
|
; I DEBUG ZWR RPCRSLT
|
2008-09-09 13:30:01 -04:00
|
|
|
S @TVMAP@(0)=RPCRSLT(0) ; SAVE NUMBER OF PROBLEMS
|
2008-07-03 21:02:47 -04:00
|
|
|
F J=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM IN THE LIST
|
|
|
|
. S VMAP=$NA(@TVMAP@(J))
|
|
|
|
. K @VMAP
|
2008-09-03 19:54:55 -04:00
|
|
|
. I DEBUG W "VMAP= ",VMAP,!
|
2008-07-03 21:02:47 -04:00
|
|
|
. S PTMP=RPCRSLT(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
|
|
|
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
|
|
|
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,1)
|
|
|
|
. S @VMAP@("PROBLEMSTATUS")=$P(PTMP,U,2)
|
|
|
|
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,3)
|
2008-09-04 10:44:39 -04:00
|
|
|
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
2008-07-03 21:02:47 -04:00
|
|
|
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,4)
|
|
|
|
. S @VMAP@("PROBLEMDATEOFONSET")=$P(PTMP,U,5)
|
|
|
|
. S @VMAP@("PROBLEMDATEMOD")=$P(PTMP,U,6)
|
|
|
|
. S @VMAP@("PROBLEMSC")=$P(PTMP,U,7)
|
|
|
|
. S @VMAP@("PROBLEMSE")=$P(PTMP,U,8)
|
|
|
|
. S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9)
|
|
|
|
. S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10)
|
|
|
|
. S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11)
|
|
|
|
. S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12)
|
|
|
|
. S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
|
|
|
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$P(X,";",1)
|
|
|
|
. S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13)
|
|
|
|
. S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14)
|
|
|
|
. S @VMAP@("PROBLEMDTREC")=$P(PTMP,U,15)
|
|
|
|
. S @VMAP@("PROBLEMINACT")=$P(PTMP,U,16)
|
|
|
|
. S ARYTMP=$NA(@TARYTMP@(J))
|
|
|
|
. ; W "ARYTMP= ",ARYTMP,!
|
|
|
|
. K @ARYTMP
|
|
|
|
. D MAP^GPLXPATH(IPXML,VMAP,ARYTMP) ;
|
|
|
|
. I J=1 D ; FIRST ONE IS JUST A COPY
|
|
|
|
. . ; W "FIRST ONE",!
|
|
|
|
. . D CP^GPLXPATH(ARYTMP,OUTXML)
|
|
|
|
. . ; W "OUTXML ",OUTXML,!
|
|
|
|
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
|
|
|
. . D INSINNER^GPLXPATH(OUTXML,ARYTMP)
|
2008-07-07 01:30:04 -04:00
|
|
|
; ZWR ^TMP("GPLCCR",$J,"PROBVALS",*)
|
|
|
|
; ZWR ^TMP("GPLCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
2008-07-03 21:02:47 -04:00
|
|
|
; ZWR @OUTXML
|
|
|
|
; $$HTML^DILF(
|
2008-07-27 16:37:10 -04:00
|
|
|
; GENERATE THE NARITIVE HTML FOR THE CCD
|
|
|
|
I CCD D ; IF THIS IS FOR A CCD
|
2008-08-12 14:45:52 -04:00
|
|
|
. N HTMP,HOUT,HTMLO,GPLPROBI,ZX
|
|
|
|
. F GPLPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
|
|
|
|
. . S VMAP=$NA(@TVMAP@(GPLPROBI))
|
2008-09-03 19:54:55 -04:00
|
|
|
. . I DEBUG W "VMAP =",VMAP,!
|
2008-08-06 13:29:59 -04:00
|
|
|
. . D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
|
|
|
|
. . D UNMARK^GPLXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
|
|
|
|
. . ; D PARY^GPLXPATH("HTMP") ; PRINT IT
|
|
|
|
. . D MAP^GPLXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
|
|
|
|
. . ; D PARY^GPLXPATH("HOUT") ; PRINT IT AGAIN
|
2008-08-12 14:45:52 -04:00
|
|
|
. . I GPLPROBI=1 D ; FIRST ONE IS JUST A COPY
|
2008-08-06 13:29:59 -04:00
|
|
|
. . . D CP^GPLXPATH("HOUT","HTMLO")
|
2008-08-12 14:45:52 -04:00
|
|
|
. . I GPLPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
|
2008-09-03 19:54:55 -04:00
|
|
|
. . . I DEBUG W "DOING INNER",!
|
2008-08-12 14:45:52 -04:00
|
|
|
. . . N HTMLBLD,HTMLTMP
|
|
|
|
. . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
|
|
|
|
. . . D QUEUE^GPLXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
|
|
|
|
. . . D QUEUE^GPLXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
|
|
|
|
. . . D BUILD^GPLXPATH("HTMLBLD","HTMLTMP")
|
|
|
|
. . . D CP^GPLXPATH("HTMLTMP","HTMLO")
|
|
|
|
. . . ; D INSINNER^GPLXPATH("HOUT","HTMLO","//")
|
2008-08-19 16:50:47 -04:00
|
|
|
. I DEBUG D PARY^GPLXPATH("HTMLO")
|
2008-08-06 13:29:59 -04:00
|
|
|
. D INSB4^GPLXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
|
2008-07-03 21:02:47 -04:00
|
|
|
N PROBSTMP,I
|
|
|
|
D MISSING^GPLXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
|
2008-07-05 11:49:50 -04:00
|
|
|
I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
|
|
|
. ; STRINGS MARKED AS @@X@@
|
2008-09-03 19:54:55 -04:00
|
|
|
. W !,"PROBLEMS Missing list: ",!
|
2008-07-03 21:02:47 -04:00
|
|
|
. F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
|
|
|
|
Q
|
|
|
|
;
|