Updated CPLCCR0 to include a more comprehensive medication section.

This commit is contained in:
sam 2008-08-17 04:49:12 +00:00
parent 2740f017cc
commit cd73b3da79
2 changed files with 103 additions and 73 deletions

View File

@ -271,21 +271,17 @@ LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
;;<CCRDataObjectID>@@MEDICATIONOBJECTID@@</CCRDataObjectID> ;;<CCRDataObjectID>@@MEDICATIONOBJECTID@@</CCRDataObjectID>
;;<DateTime> ;;<DateTime>
;;<Type> ;;<Type>
;;<Text>@@MEDICATIONDATETIMETEXT@@</Text> ;;<Text>@@MEDICATIONISSUEDATETXT@@</Text>
;;</Type> ;;</Type>
;;<Age> ;;<ExactDateTime>@@MEDICATIONISSUEDATE@@</ExactDateTime>
;;<Value>@@MEDICATIONDATETIMEAGE@@</Value> ;;<Type>
;;<Units> ;;<Text>@@MEDICATIONLASTFILLDATETXT@@</Text>
;;<Unit>@@MEDICATIONDATETIMEAGEUNITS@@</Unit> ;;</Type>
;;</Units> ;;<ExactDateTime>@@MEDICATIONLASTFILLDATE@@</ExactDateTime>
;;</Age>
;;</DateTime> ;;</DateTime>
;;<Type> ;;<Type>
;;<Text>@@MEDICATIONTYPETEXT@@</Text> ;;<Text>@@MEDICATIONTYPETEXT@@</Text>
;;</Type> ;;</Type>
;;<Description>
;;<Text>@@MEDICATIONDESCRIPTIONTEXT@@</Text>
;;</Description>
;;<Status> ;;<Status>
;;<Text>@@MEDICATIONSTATUSTEXT@@</Text> ;;<Text>@@MEDICATIONSTATUSTEXT@@</Text>
;;</Status> ;;</Status>
@ -305,11 +301,6 @@ LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
;;</ProductName> ;;</ProductName>
;;<BrandName> ;;<BrandName>
;;<Text>@@MEDICATIONBRANDNAMETEXT@@</Text> ;;<Text>@@MEDICATIONBRANDNAMETEXT@@</Text>
;;<Code>
;;<Value>@@MEDICATIONBRANDNAMECODEVALUE@@</Value>
;;<CodingSystem>@@MEDICATIONBRANDNAMECODINGSYSTEM@@</CodingSystem>
;;<Version>@@MEDICATIONBRANDNAMECODEVERSION@@</Version>
;;</Code>
;;</BrandName> ;;</BrandName>
;;<Strength> ;;<Strength>
;;<Value>@@MEDICATIONSTRENGTHVALUE@@</Value> ;;<Value>@@MEDICATIONSTRENGTHVALUE@@</Value>
@ -320,21 +311,60 @@ LOAD(ARY) ; LOAD A CCR TEMPLATE INTO ARY PASSED BY NAME
;;<Form> ;;<Form>
;;<Text>@@MEDICATIONFORMTEXT@@</Text> ;;<Text>@@MEDICATIONFORMTEXT@@</Text>
;;</Form> ;;</Form>
;;<Concentration>
;;<Text>@@MEDICATIONCONCENTRATIONTEXT@@</Text>
;;</Concentration>
;;<Size>
;;<Text>@@MEDICATIONSIZETEXT</Text>
;;</Size>
;;</Product> ;;</Product>
;;<Quantity>
;;<Value>@@MEDICATIONQUANTITYVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONQUANTITYUNIT@@</Unit>
;;</Units>
;;<Directions> ;;<Directions>
;;<Direction> ;;<Direction>
;;<Description> ;;<Description>
;;<Text>@@MEDICATIONDIRECTIONDESCRIPTIONTEXT@@</Text> ;;<Text>@@MEDICATIONDIRECTIONDESCRIPTIONTEXT@@</Text>
;;</Description> ;;</Description>
;;<DoseIndicator>@@MEDICATIONDOSEINDICATOR@@</DoseIndicator>
;;<DeliveryMethod>@@MEDICATIONDELIVERYMETHOD@@</DeliveryMethod>
;;<Dose> ;;<Dose>
;;<Value>@@MEDICATIONDIRECTIONDOSEVALUE@@</Value> ;;<Value>@@MEDICATIONDIRECTIONDOSEVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONDOSEUNIT@@</Unit>
;;</Units>
;;<Rate>
;;<Value>@@MEDICATIONDIRECTIONRATEVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONRATEUNIT@@</Unit>
;;</Units>
;;</Rate>
;;</Dose> ;;</Dose>
;;<Vehicle>
;;<Text>@@MEDICATIONVEHICLETEXT@@</Text>
;;</Vehicle>
;;<Route> ;;<Route>
;;<Text>@@MEDICATIONDIRECTIONROUTETEXT@@</Text> ;;<Text>@@MEDICATIONDIRECTIONROUTETEXT@@</Text>
;;</Route> ;;</Route>
;;<Frequency> ;;<Frequency>
;;<Value>@@MEDICATIONDIRECTIONFREQUENCYVALUE@@</Value> ;;<Value>@@MEDICATIONFREQUENCYVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONFREQUENCYUNIT@@</Unit>
;;<Units>
;;</Frequency> ;;</Frequency>
;;<Interval>
;;<Value>@@MEDICATIONINTERVALVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONINTERVALUNIT@@</Unit>
;;<Units>
;;</Interval>
;;<Duration>
;;<Value>@@MEDICATIONDURATIONVALUE@@</Value>
;;<Units>
;;<Unit>@@MEDICATIONDURATIONUNIT@@</Unit>
;;</Duration>
;;</Direction> ;;</Direction>
;;</Directions> ;;</Directions>
;;</Medication> ;;</Medication>

View File

@ -17,65 +17,65 @@ GPLMEDS ; CCDCCR/CJE - CCR/CCD PROCESSING FOR MEDICATIONS ;07/23/08 14:33
;with this program; if not, write to the Free Software Foundation, Inc., ;with this program; if not, write to the Free Software Foundation, Inc.,
;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; ;
W "NO ENTRY FROM TOP",! W "NO ENTRY FROM TOP",!
Q Q
; ;
EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE EXTRACT(MEDXML,DFN,MEDOUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
; ;
; MEDXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED ; MEDXML AND OUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
; IMEDXML WILL CONTAIN ONLY THE MEDICATIONS SECTION OF THE OVERALL TEMPLATE ; IMEDXML WILL CONTAIN ONLY THE MEDICATIONS SECTION OF THE OVERALL TEMPLATE
; ;
N MEDRSLT,I,J,K,MEDPTMP,X,MEDVMAP,TBUF N MEDRSLT,I,J,K,MEDPTMP,X,MEDVMAP,TBUF
D ACTIVE^ORWPS(.MEDRSLT,DFN) D ACTIVE^ORWPS(.MEDRSLT,DFN)
I '$D(MEDRSLT(1)) D ; NO MEDS FOR THIS PATIENT, EXIT I '$D(MEDRSLT(1)) D ; NO MEDS FOR THIS PATIENT, EXIT
. W "ERROR RUNNINIG MEDICATIONS RPC",! . W "ERROR RUNNINIG MEDICATIONS RPC",!
. S @MEDOUTXML@(0)=0 . S @MEDOUTXML@(0)=0
. Q . Q
IF DEBUG ZWR MEDRSLT IF DEBUG ZWR MEDRSLT
S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS")) S MEDTVMAP=$NA(^TMP("GPLCCR",$J,"MEDICATIONS"))
S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP")) S MEDTARYTMP=$NA(^TMP("GPLCCR",$J,"MEDARYTMP"))
F J=1:3 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST F J=1:3 Q:'$D(MEDRSLT(J)) D ; FOR EACH MEDICATION IN THE LIST
. W "J IS ",J,! . W "J IS ",J,!
. S MEDVMAP=$NA(@MEDTVMAP@(J)) . S MEDVMAP=$NA(@MEDTVMAP@(J))
. K @MEDVMAP . K @MEDVMAP
. I DEBUG W "VMAP= ",VMAP,! . I DEBUG W "VMAP= ",VMAP,!
. S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY . S MEDPTMP=MEDRSLT(J) ; PULL OUT MEDICATION FROM RPC RETURN ARRAY
. S @MEDVMAP@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDS . S @MEDVMAP@("MEDICATIONOBJECTID")="MED"_J ; UNIQUE OBJID FOR MEDS
. ; PROCESSING FOR MEDS GOES HERE . ; PROCESSING FOR MEDS GOES HERE
. S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT") ; GETS LAST FILL DATE . S @MEDVMAP@("MEDICATIONDATETIMETEXT")=$$FMDTOUTC^CCRUTIL($P(MEDPTMP,"^",11),"DT") ; GETS LAST FILL DATE
. S @MEDVMAP@("MEDICATIONDATETIMEAGE")="" . S @MEDVMAP@("MEDICATIONDATETIMEAGE")=""
. S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")="" . S @MEDVMAP@("MEDICATIONDATETIMEAGEUNITS")=""
. S @MEDVMAP@("MEDICATIONTYPETEXT")="Medication" . S @MEDVMAP@("MEDICATIONTYPETEXT")="Medication"
. S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10) ; STATUS FROM RPC . S @MEDVMAP@("MEDICATIONSTATUSTEXT")=$P(MEDPTMP,"^",10) ; STATUS FROM RPC
. S @MEDVMAP@("MEDICATIONSOURCEACTORID")="ACTORSYSTEM_1" . S @MEDVMAP@("MEDICATIONSOURCEACTORID")="ACTORSYSTEM_1"
. S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")=$P(MEDPTMP,"^",3) . S @MEDVMAP@("MEDICATIONPRODUCTNAMETEXT")=$P(MEDPTMP,"^",3)
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")="" . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVALUE")=""
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")="" . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODINGINGSYSTEM")=""
. S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")="" . S @MEDVMAP@("MEDICATIONPRODUCTNAMECODEVERSION")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")="" . S @MEDVMAP@("MEDICATIONBRANDNAMETEXT")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")="" . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVALUE")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")="" . S @MEDVMAP@("MEDICATIONBRANDNAMECODINGSYSTEM")=""
. S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")="" . S @MEDVMAP@("MEDICATIONBRANDNAMECODEVERSION")=""
. S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")="" . S @MEDVMAP@("MEDICATIONSTRENGTHVALUE")=""
. S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")="" . S @MEDVMAP@("MEDICATIONSTRENGTHUNIT")=""
. S @MEDVMAP@("MEDICATIONFORMTEXT")="" . S @MEDVMAP@("MEDICATIONFORMTEXT")=""
. S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+1)," *",2) . S @MEDVMAP@("MEDICATIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+1)," *",2)
. S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+2),"\ Sig: ",2) . S @MEDVMAP@("MEDICATIONDIRECTIONDESCRIPTIONTEXT")=$P(MEDRSLT(J+2),"\ Sig: ",2)
. S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")="" . S @MEDVMAP@("MEDICATIONDIRECTIONDOSEVALUE")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")="" . S @MEDVMAP@("MEDICATIONDIRECTIONROUTETEXT")=""
. S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")="" . S @MEDVMAP@("MEDICATIONDIRECTIONFREQUENCYVALUE")=""
. S MEDARYTMP=$NA(@MEDTARYTMP@(J)) . S MEDARYTMP=$NA(@MEDTARYTMP@(J))
. K @MEDARYTMP . K @MEDARYTMP
. D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP) . D MAP^GPLXPATH(MEDXML,MEDVMAP,MEDARYTMP)
. I J=1 D ; FIRST ONE IS JUST A COPY . I J=1 D ; FIRST ONE IS JUST A COPY
. . ; W "FIRST ONE",! . . ; W "FIRST ONE",!
. . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML) . . D CP^GPLXPATH(MEDARYTMP,MEDOUTXML)
. I J>1 D ; AFTER THE FIRST, INSERT INNER XML . I J>1 D ; AFTER THE FIRST, INSERT INNER XML
. . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP) . . D INSINNER^GPLXPATH(MEDOUTXML,MEDARYTMP)
N MEDTMP,MEDI N MEDTMP,MEDI
D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS D MISSING^GPLXPATH(MEDOUTXML,"MEDTMP") ; SEARCH XML FOR MISSING VARS
I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@ I MEDTMP(0)>0 D ; IF THERE ARE MISSING VARS - MARKED AS @@X@@
. W "MEDICATION MISSING ",! . W "MEDICATION MISSING ",!
. F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),! . F MEDI=1:1:MEDTMP(0) W MEDTMP(MEDI),!
Q Q
; ;