refactored routine to get RPMS Problem list in the correct format.
TODO: parse and code more problem statuses.
This commit is contained in:
parent
f0f79191ce
commit
2b2fe9b5e1
123
p/C0CPROBS.m
123
p/C0CPROBS.m
|
@ -1,5 +1,5 @@
|
|||
C0CPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
||||
;;1.0;C0C;;May 19, 2009;
|
||||
C0CPROBS ; CCDCCR/GPL/CJE - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
||||
;;1.0;C0C;;May 19, 2009;Build 32
|
||||
;Copyright 2008,2009 George Lilly, University of Minnesota.
|
||||
;Licensed under the terms of the GNU General Public License.
|
||||
;See attached copy of the License.
|
||||
|
@ -21,7 +21,7 @@ C0CPROBS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR PROBLEMS ; 6/6/08
|
|||
;
|
||||
; PROCESS THE PROBLEMS SECTION OF THE CCR
|
||||
;
|
||||
EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
||||
EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
||||
;
|
||||
; INXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
||||
; INXML WILL CONTAIN ONLY THE PROBLEM SECTION OF THE OVERALL TEMPLATE
|
||||
|
@ -33,9 +33,67 @@ EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
|||
S TVMAP=$NA(^TMP("C0CCCR",$J,"PROBVALS"))
|
||||
S TARYTMP=$NA(^TMP("C0CCCR",$J,"PROBARYTMP"))
|
||||
K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
|
||||
I '$T(GET^BGOPRB) D ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
|
||||
. D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
|
||||
E D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
|
||||
I $$RPMS^C0CUTIL() D RPMS ; IF BGOPRB ROUTINE IS MISSING (IE RPMS)
|
||||
I ($$VISTA^C0CUTIL())!($$WV^C0CUTIL())!($$OV^C0CUTIL()) D VISTA QUIT
|
||||
Q
|
||||
;
|
||||
RPMS ; GETS THE PROBLEM LIST FOR RPMS
|
||||
S RPCGLO=$NA(^TMP("BGO",$J))
|
||||
D GET^BGOPROB(.RPCRSLT,DFN) ; CALL THE PROBLEM LIST RPC
|
||||
; FORMAT OF RPC:
|
||||
; Number Code [1] ^ Patient IEN [2] ^ ICD Code [3] ^ Modify Date [4] ^ Class [5] ^ Provider Narrative [6] ^
|
||||
; Date Entered [7] ^ Status [8] ^ Date Onset [9] ^ Problem IEN [10] ^ Notes [11] ^ ICD9 IEN [12] ^
|
||||
; ICD9 Short Name [13] ^ Provider [14] ^ Facility IEN [15] ^ Priority [16]
|
||||
I '$D(@RPCGLO) W "NULL RESULT FROM GET^BGOPROB ",! S @OUTXML@(0)=0 Q
|
||||
S J=""
|
||||
F S J=$O(@RPCGLO@(J)) Q:J="" D ; FOR EACH PROBLEM IN THE LIST
|
||||
. S VMAP=$NA(@TVMAP@(J))
|
||||
. K @VMAP
|
||||
. I DEBUG W "VMAP= ",VMAP,!
|
||||
. S PTMP=@RPCRSLT@(J) ; PULL OUT PROBLEM FROM RPC RETURN ARRAY
|
||||
. N C0CG1,C0CT ; ARRAY FOR VALUES FROM GLOBAL
|
||||
. D GETN1^C0CRNF("C0CG1",9000011,$P(PTMP,U,10),"") ;GET VALUES BY NAME
|
||||
. S @VMAP@("PROBLEMOBJECTID")="PROBLEM"_J ; UNIQUE OBJID FOR PROBLEM
|
||||
. S @VMAP@("PROBLEMIEN")=$P(PTMP,U,10)
|
||||
. S @VMAP@("PROBLEMSTATUS")=$S($P(PTMP,U,8)="A":"Active",1:"")
|
||||
. S @VMAP@("PROBLEMDESCRIPTION")=$P(PTMP,U,6)
|
||||
. S @VMAP@("PROBLEMCODINGVERSION")=""
|
||||
. S @VMAP@("PROBLEMCODEVALUE")=$P(PTMP,U,3)
|
||||
. S @VMAP@("PROBLEMDATEOFONSET")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE OF ONSET","C0CG1"),"DT")
|
||||
. S @VMAP@("PROBLEMDATEMOD")=$$FMDTOUTC^C0CUTIL($$ZVALUEI^C0CRNF("DATE LAST MODIFIED","C0CG1"),"DT")
|
||||
. ;S @VMAP@("PROBLEMSC")=$P(PTMP,U,7) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMSE")=$P(PTMP,U,8) ;UNKNOWN NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMCONDITION")=$P(PTMP,U,9) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMLOC")=$P(PTMP,U,10) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMLOCTYPE")=$P(PTMP,U,11) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMPROVIDER")=$P(PTMP,U,12) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S X=@VMAP@("PROBLEMPROVIDER") ; FORMAT Y;NAME Y IS IEN OF PROVIDER
|
||||
. S @VMAP@("PROBLEMSOURCEACTORID")="ACTORPROVIDER_"_$$ZVALUEI^C0CRNF("RECORDING PROVIDER","C0CG1")
|
||||
. ;S @VMAP@("PROBLEMSERVICE")=$P(PTMP,U,13) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMHASCMT")=$P(PTMP,U,14) ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMDTREC")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,15),"DT") ;NOT MAPPED IN C0CCCR0
|
||||
. ;S @VMAP@("PROBLEMINACT")=$$FMDTOUTC^C0CUTIL($P(PTMP,U,16),"DT") ;NOT MAPPED IN C0CCCR0
|
||||
. S ARYTMP=$NA(@TARYTMP@(J))
|
||||
. ; W "ARYTMP= ",ARYTMP,!
|
||||
. K @ARYTMP
|
||||
. D MAP^C0CXPATH(IPXML,VMAP,ARYTMP) ;
|
||||
. I J=1 D ; FIRST ONE IS JUST A COPY
|
||||
. . ; W "FIRST ONE",!
|
||||
. . D CP^C0CXPATH(ARYTMP,OUTXML)
|
||||
. . ; W "OUTXML ",OUTXML,!
|
||||
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
|
||||
. . D INSINNER^C0CXPATH(OUTXML,ARYTMP)
|
||||
; ZWR ^TMP("C0CCCR",$J,"PROBVALS",*)
|
||||
; ZWR ^TMP("C0CCCR",$J,"PROBARYTMP",*) ; SHOW THE RESULTS
|
||||
; ZWR @OUTXML
|
||||
; $$HTML^DILF(
|
||||
; GENERATE THE NARITIVE HTML FOR THE CCD
|
||||
I CCD D CCD ; IF THIS IS FOR A CCD
|
||||
D MISSINGVARS
|
||||
Q
|
||||
;
|
||||
VISTA ; GETS THE PROBLEM LIST FOR VISTA
|
||||
D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
|
||||
I '$D(RPCRSLT(1)) D Q ; RPC RETURNS NULL
|
||||
. W "NULL RESULT FROM LIST^ORQQPL3 ",!
|
||||
. S @OUTXML@(0)=0
|
||||
|
@ -82,29 +140,34 @@ EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
|||
; ZWR @OUTXML
|
||||
; $$HTML^DILF(
|
||||
; GENERATE THE NARITIVE HTML FOR THE CCD
|
||||
I CCD D ; IF THIS IS FOR A CCD
|
||||
. N HTMP,HOUT,HTMLO,C0CPROBI,ZX
|
||||
. F C0CPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
|
||||
. . S VMAP=$NA(@TVMAP@(C0CPROBI))
|
||||
. . I DEBUG W "VMAP =",VMAP,!
|
||||
. . D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
|
||||
. . D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
|
||||
. . ; D PARY^C0CXPATH("HTMP") ; PRINT IT
|
||||
. . D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
|
||||
. . ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
|
||||
. . I C0CPROBI=1 D ; FIRST ONE IS JUST A COPY
|
||||
. . . D CP^C0CXPATH("HOUT","HTMLO")
|
||||
. . I C0CPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
|
||||
. . . I DEBUG W "DOING INNER",!
|
||||
. . . N HTMLBLD,HTMLTMP
|
||||
. . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
|
||||
. . . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
|
||||
. . . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
|
||||
. . . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
|
||||
. . . D CP^C0CXPATH("HTMLTMP","HTMLO")
|
||||
. . . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
|
||||
. I DEBUG D PARY^C0CXPATH("HTMLO")
|
||||
. D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
|
||||
I CCD D CCD ; IF THIS IS FOR A CCD
|
||||
D MISSINGVARS
|
||||
Q
|
||||
CCD
|
||||
N HTMP,HOUT,HTMLO,C0CPROBI,ZX
|
||||
F C0CPROBI=1:1:RPCRSLT(0) D ; FOR EACH PROBLEM
|
||||
. S VMAP=$NA(@TVMAP@(C0CPROBI))
|
||||
. I DEBUG W "VMAP =",VMAP,!
|
||||
. D QUERY^C0CXPATH(TGLOBAL,"//ContinuityOfCareRecord/Body/PROBLEMS-HTML","HTMP") ; GET THE HTML FROM THE TEMPLATE
|
||||
. D UNMARK^C0CXPATH("HTMP") ; REMOVE <PROBLEMS-HTML> MARKUP
|
||||
. ; D PARY^C0CXPATH("HTMP") ; PRINT IT
|
||||
. D MAP^C0CXPATH("HTMP",VMAP,"HOUT") ; MAP THE VARIABLES
|
||||
. ; D PARY^C0CXPATH("HOUT") ; PRINT IT AGAIN
|
||||
. I C0CPROBI=1 D ; FIRST ONE IS JUST A COPY
|
||||
. . D CP^C0CXPATH("HOUT","HTMLO")
|
||||
. I C0CPROBI>1 D ; AFTER THE FIRST, INSERT INNER HTML
|
||||
. . I DEBUG W "DOING INNER",!
|
||||
. . N HTMLBLD,HTMLTMP
|
||||
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",1,HTMLO(0)-1)
|
||||
. . D QUEUE^C0CXPATH("HTMLBLD","HOUT",2,HOUT(0)-1)
|
||||
. . D QUEUE^C0CXPATH("HTMLBLD","HTMLO",HTMLO(0),HTMLO(0))
|
||||
. . D BUILD^C0CXPATH("HTMLBLD","HTMLTMP")
|
||||
. . D CP^C0CXPATH("HTMLTMP","HTMLO")
|
||||
. . ; D INSINNER^C0CXPATH("HOUT","HTMLO","//")
|
||||
I DEBUG D PARY^C0CXPATH("HTMLO")
|
||||
D INSB4^C0CXPATH(OUTXML,"HTMLO") ; INSERT AT TOP OF SECTION
|
||||
Q
|
||||
MISSINGVARS
|
||||
N PROBSTMP,I
|
||||
D MISSING^C0CXPATH(ARYTMP,"PROBSTMP") ; SEARCH XML FOR MISSING VARS
|
||||
I PROBSTMP(0)>0 D ; IF THERE ARE MISSING VARS -
|
||||
|
@ -112,4 +175,4 @@ EXTRACT(IPXML,DFN,OUTXML) ; EXTRACT PROBLEMS INTO PROVIDED XML TEMPLATE
|
|||
. W !,"PROBLEMS Missing list: ",!
|
||||
. F I=1:1:PROBSTMP(0) W PROBSTMP(I),!
|
||||
Q
|
||||
;
|
||||
;
|
Loading…
Reference in New Issue