diff --git a/p/CCRMEDS6.m b/p/CCRMEDS6.m index b5761d0..01c8cf8 100644 --- a/p/CCRMEDS6.m +++ b/p/CCRMEDS6.m @@ -202,10 +202,24 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE . . ; However, it gets translated by a call to the administration schedule file . . ; to see if that schedule exists. . . ; That's the same thing I am going to do. - . . ; Search B index of 51.1 (Admin Schedule) with first abbr of schedule - . . N SCHEDIEN S SCHEDIEN=$$FIND1^DIC(51.1,,,$P(SIGDATA(7)," "),"B") + . . ; Search B index of 51.1 (Admin Schedule) with schedule + . . ; First, remove "PRN" if it exists (don't ask, that's how the file + . . ; works; I wouldn't do it that way). + . . N SCHNOPRN S SCHNOPRN=SIGDATA(7) + . . I SCHNOPRN["PRN" S SCHNOPRN=$E(SCHNOPRN,1,$F(SCHNOPRN,"PRN")-5) + . . ; Super call below: + . . ; 1=File 51.1 3=Field 2 (Frequency in Minutes) + . . ; 4=Packed format, Exact Match 5=Lookup Value + . . ; 6=# of entries to return 7=Index 10=Return Array + . . ; + . . ; I do not account for the fact that two schedules can be + . . ; spelled identically (ie duplicate entry). In that case, + . . ; I get the first. That's just a bad pharmacy pkg maintainer. + . . N C0C515 + . . D FIND^DIC(51.1,,"@;2","PX",SCHNOPRN,1,"B",,,"C0C515") . . N INTERVAL S INTERVAL="" ; Default - . . S:SCHEDIEN INTERVAL=$$GET1^DIQ(51.1,SCHEDIEN,2) + . . ; If there are entries found, get it + . . I +$G(C0C515("DILIST",0)) S INTERVAL=$P(C0C515("DILIST",1,0),U,2) . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALVALUE")=INTERVAL . . S @MAP@("M","DIRECTIONS",DIRCNT,"MEDINTERVALUNIT")="Minute" . . ; Duration is 10M minutes, 10H hours, 10D for Days diff --git a/p/CCRUNIT.m b/p/CCRUNIT.m index 5b609a7..a7f3df0 100644 --- a/p/CCRUNIT.m +++ b/p/CCRUNIT.m @@ -13,8 +13,7 @@ MEDS W "Getting Med Template into INXML using",! W "QUERY^GPLXPATH(T,XPATH,""INXML"")",!! D QUERY^GPLXPATH(T,XPATH,"INXML") - B - W "Executing EXTRACT^CCRMEDS(INXML,DFN,OUTXML)",! + W "Executing EXTRACT^CCRMEDS(INXML,DFN,OUTXML)",! W "OUTXML will be ^TMP($J,""OUT"")",! N OUTXML S OUTXML=$NA(^TMP($J,"OUT")) D EXTRACT^CCRMEDS6("INXML",DFN,OUTXML)