added processing for meds in GPLCCR.m

added <description><text></text></description> for meds in GPLCCR0.m
changed I variables in GPLCCR.m so that it would run
This commit is contained in:
cje 2008-07-30 14:00:08 +00:00
parent e3cb27c3be
commit 17411a6e9b
3 changed files with 42 additions and 35 deletions

View File

@ -30,8 +30,8 @@ EXPORT ; EXPORT ENTRY POINT FOR CCR
S ONAM="PAT_"_DFN_"_CCR_V1.xml"
S ODIRGLB=$NA(^TMP("GPLCCR","ODIR"))
I '$D(@ODIRGLB) D ; IF NOT ODIR HAS BEEN SET
. S @ODIRGLB="/home/glilly/CCROUT"
. ;S @ODIRGLB="/home/cedwards/"
. ;S @ODIRGLB="/home/glilly/CCROUT"
. S @ODIRGLB="/home/cedwards/"
. ;S @ODIRGLB="/opt/wv/p/"
S ODIR=@ODIRGLB
D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
@ -71,9 +71,9 @@ CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT
K ^TMP("GPLCCR",$J,"CCRSTEP") ; KILL GLOBAL PRIOR TO ADDING TO IT
S CCRXTAB=$NA(^TMP("GPLCCR",$J,"CCRSTEP")) ; GLOBAL TO STORE CCR STEPS
D INITSTPS(CCRXTAB) ; INITIALIZED CCR PROCESSING STEPS
N I,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
F I=1:1:@CCRXTAB@(0) D ; PROCESS THE CCR BODY SECTIONS
. S XI=@CCRXTAB@(I) ; CALL COPONENTS TO PARSE
N PROCI,XI,TAG,RTN,CALL,XPATH,IXML,OXML,INXML,CCRBLD
F PROCI=1:1:@CCRXTAB@(0) D ; PROCESS THE CCR BODY SECTIONS
. S XI=@CCRXTAB@(PROCI) ; CALL COPONENTS TO PARSE
. S RTN=$P(XI,";",2) ; NAME OF ROUTINE TO CALL
. S TAG=$P(XI,";",1) ; LABEL INSIDE ROUTINE TO CALL
. S XPATH=$P(XI,";",3) ; XPATH TO XML TO PASS TO ROUTINE
@ -91,8 +91,8 @@ CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT
D QUERY^GPLXPATH(TGLOBAL,"//ContinuityOfCareRecord/Actors","ACTT")
D EXTRACT^GPLACTORS("ACTT",ACTGLO,"ACTT2")
D INSINNER^GPLXPATH(CCRGLO,"ACTT2","//ContinuityOfCareRecord/Actors")
N I,J,DONE S DONE=0
F I=0:0 D Q:DONE ; DELETE UNTIL ALL EMPTY ELEMENTS ARE GONE
N TRIMI,J,DONE S DONE=0
F TRIMI=0:0 D Q:DONE ; DELETE UNTIL ALL EMPTY ELEMENTS ARE GONE
. S J=$$TRIM^GPLXPATH(CCRGLO) ; DELETE EMPTY ELEMENTS
. W "TRIMMED",J,!
. I J=0 S DONE=1 ; DONE WHEN TRIM RETURNS FALSE
@ -103,7 +103,7 @@ INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS
W "TAB= ",TAB,!
; ORDER FOR CCR IS PROBLEMS,FAMILYHISTORY,SOCIALHISTORY,MEDICATIONS,VITALSIGNS,RESULTS,HEALTHCAREPROVIDERS
D PUSH^GPLXPATH(TAB,"EXTRACT;GPLPROBS;//ContinuityOfCareRecord/Body/Problems;^TMP(""GPLCCR"",$J,DFN,""PROBLEMS"")")
;D PUSH^GPLXPATH(TAB,"EXTRACT;GPLMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""GPLCCR"",$J,DFN,""MEDICATIONS"")")
D PUSH^GPLXPATH(TAB,"EXTRACT;GPLMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""GPLCCR"",$J,DFN,""MEDICATIONS"")")
D PUSH^GPLXPATH(TAB,"EXTRACT;GPLVITALS;//ContinuityOfCareRecord/Body/VitalSigns;^TMP(""GPLCCR"",$J,DFN,""VITALS"")")
I TESTLAB D PUSH^GPLXPATH(TAB,"EXTRACT;GPLLABS;//ContinuityOfCareRecord/Body/Results;^TMP(""GPLCCR"",$J,DFN,""RESULTS"")")
Q

View File

@ -283,6 +283,9 @@ LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
;;<Type>
;;<Text>@@MEDICATIONTYPETEXT@@</Text>
;;</Type>
;;<Description>
;;<Text>@@MEDICATIONDESCRIPTIONTEXT@@</Text>
;;</Description>
;;<Status>
;;<Text>@@MEDICATIONSTATUSTEXT@@</Text>
;;</Status>

View File

@ -27,51 +27,55 @@ EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
;
N MEDRSLT,J,K,MEDPTMP,X,MEDVMAP,TBUF
D ACTIVE^ORWPS(.MEDRSLT,DFN)
Q
ZWR MEDRSLT
I '$D(MEDRSLT(1)) W "ERROR RUNNINIG MEDICATIONS RPC",! Q
S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
F J=1:1 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
. W "J IS",J,!
. S MEDVMAP=$NA(@MEDTVMAP@(J))
. K @MEDVMAP
. I DEBUG W "VMAP= ",VMAP,!
. S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY
. S @MEDVMAP@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDICATION
. ; PROCESSING FOR MEDS GOES HERE
. S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT")
. S @MEDVMAP@("MEDICATIONDATETIMEAGE")="TEST2"
. S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")="TEST3"
. S @MEDVMAP@("MEDICATIONTYPETEXT")="TEST4"
. S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10)
. S @MEDVMAP@("MEDICATIONSOURCEACTORID")="TEST6"
. S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")="TEST7"
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")="TEST8"
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")="TEST9"
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")="TEST10"
. S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")="TEST11"
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")="TEST12"
. S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")="TEST13"
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")="TEST14"
. S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")="TEST15"
. S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")="TEST16"
. S @MEDVMAP@("MEDICATIONFORMTEXT")="TEST17"
. S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")="TEST18"
. S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")="TEST19"
. S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")="TEST20"
. S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")="TEST21"
. S J=J+3
. S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT") ; GETS LAST FILL DATE
. S @MEDVMAP@("MEDICATIONDATETIMEAGE")=""
. S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")=""
. S @MEDVMAP@("MEDICATIONTYPETEXT")="Medication"
. S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10) ; STATUS FROM RPC
. S @MEDVMAP@("MEDICATIONSOURCEACTORID")=""
. S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")=$P(MEDPTMP,"^",3)
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")=""
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")=""
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")=""
. S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")=""
. S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")=""
. S @MEDVMAP@("MEDICATIONFORMTEXT")=""
. S J=J+1
. S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J)," *",2)
. S J=J+1
. S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J),"\ Sig: ",2)
. S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")=""
. S MEDARYTMP=$NA(@MEDTARYTMP@(J))
. K @MEDARYTMP
. D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
. I J=1 D ; FIRST ONE IS JUST A COPY
. I J=3 D ; FIRST ONE IS JUST A COPY
. . ; W "FIRST ONE",!
. . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML
. I J>3 D ; AFTER THE FIRST, INSERT INNER XML
. . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
N MEDTMP,I
. S J=J+1
N MEDTMP,MEDI
D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
. W "MEDICATION MISSING ",!
. F I=1:1:MEDTMP(0) W MEDTMP(I),!
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
Q
;