Updated CCRMEDS

This commit is contained in:
sam 2008-08-29 22:11:36 +00:00
parent c1a4e7946e
commit 327153a58e
1 changed files with 137 additions and 119 deletions

View File

@ -39,9 +39,9 @@ EXTRACT(INXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
K ^TMP($J)
D RX^PSO52API(DFN,"CCDCCR")
M MEDS=^TMP($J,"CCDCCR",DFN)
; @(0) contains the number of meds.
; If there are no meds (@(0)=0), we quit.
I 'MEDS(0) S @OUTXML@(0)=0 QUIT
; @(0) contains the number of meds or -1^NO DATA FOUND
; If it is -1, we quit.
I $P(MEDS(0),U)=-1 S @OUTXML@(0)=0 QUIT
I DEBUG ZWR MEDS
N RXIEN S RXIEN=0
F S RXIEN=$O(MEDS(RXIEN)) Q:RXIEN="" D ; FOR EACH MEDICATION IN THE LIST
@ -71,13 +71,31 @@ EXTRACT(INXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN)
. S @MAP@("MEDSTRENGTHVALUE")=DOSEDATA(901)
. S @MAP@("MEDSTRENGTHUNIT")=$P(DOSEDATA(902),U,2)
. S @MAP@("MEDFORMTEXT")=$P(MED("OI"),U,4)
. S @MAP@("MEDCONCVALUE")
. S @MAP@("MEDCONCUNIT")
. S @MAP@("MEDSIZETEXT")
. S @MAP@("MEDQUANTITYVALUE")
. S @MAP@("MEDQUANTITYUNIT")
. S @MAP@("MEDDIRECTIONDESCRIPTIONTEXT")
. ; Units, concentration, etc, come from another call
. ; $$CPRS^PSNAPIS which returns dosage-form^va class^strengh^unit
. ; This call takes nodes 1 and 3 of ^PSDRUG(D0,"ND") as parameters
. ; NDF Entry IEN, and VA Product Name
. ; These can be obtained using NDF^PSS50 (IEN,,,,,"SUBSCRIPT")
. ; Documented in the same manual.
. N IEN S IEN=^PSDRUG($P(MED(6),U))
. D NDF^PSS50(IEN,,,,,"CONC")
. N NDFDATA M NDFDATA=^TMP($J,"CONC",IEN)
. N NDFIEN S NDFIEN=$P(NDFDATA(20),U)
. N VAPROD S VAPROD=$P(NDFDATA(22),U)
. N CONCDATA S CONCDATA=$$CPRS^PSNAPIS(NDFIEN,VAPROD)
. S @MAP@("MEDFORMTEXT")=$P(CONCDATA,U,1)
. S @MAP@("MEDCONCVALUE")=$P(CONCDATA,U,3)
. S @MAP@("MEDCONCUNIT")=$P(CONCDATA,U,4)
. S @MAP@("MEDSIZETEXT")=$P(NDFDATA(23),U,2)_" "_$P(NDFDATA(24),U,2)
. S @MAP@("MEDQUANTITYVALUE")=MED(7)
. ; Oddly, there is no easy place to find the dispense unit.
. ; It's not included in the original call, so we have to go to the drug file.
. ; That would be DATA^PSS50(IEN,,,,,"SUBSCRIPT")
. ; Node 14.5 is the Dispense Unit
. D DATA^PSS50(IEN,,,,,"QTY")
. N QTYDATA M QTYDATA=^TMP($J,"QTY",IEN)
. S @MAP@("MEDQUANTITYUNIT")=QTYDATA(14.5)
. S @MAP@("MEDDIRECTIONDESCRIPTIONTEXT")=""
. S @MAP@("MEDDOSEINDICATOR")
. S @MAP@("MEDDELIVERYMETHOD")
. S @MAP@("MEDDOSEVALUE")
@ -104,7 +122,7 @@ EXTRACT(INXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. S @MAP@("MEDMULDIRMOD")
. S @MAP@("MEDPTINSTRUCTIONS")
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")
. S @MAP@("MEDRFNO")
. S @MAP@("MEDRFNO")=MED(9)
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"RESULT",J))
. K @RESULT
. D MAP^GPLXPATH(INXML,MAP,RESULT)