diff --git a/p/CCRMEDS1.m b/p/CCRMEDS1.m index d3af3d8..ecd97a2 100644 --- a/p/CCRMEDS1.m +++ b/p/CCRMEDS1.m @@ -96,7 +96,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE . ; To protect against failure, I will put an if/else block . ; . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER - . I NDFIEN D + . I NDFIEN,$D(^C0CRXN) D ; $Data is for Systems that don't have our RxNorm file yet. . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99) . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID") . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01) diff --git a/p/CCRMEDS2.m b/p/CCRMEDS2.m index e933814..291a84d 100644 --- a/p/CCRMEDS2.m +++ b/p/CCRMEDS2.m @@ -111,7 +111,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEM . . ; new on the market, compounded, or is a fake drug [blue pill]. . . ; To protect against failure, I will put an if/else block . . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER - . . I NDFIEN D + . . I NDFIEN,$D(^C0CRXN) D ; $Data is for Systems that don't have our RxNorm file yet. . . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99) . . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID") . . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01) diff --git a/p/CCRMEDS3.m b/p/CCRMEDS3.m index f1898ad..a5b7c14 100644 --- a/p/CCRMEDS3.m +++ b/p/CCRMEDS3.m @@ -104,7 +104,7 @@ EXTRACT(MINXML,DFN,OUTXML) ; Extract medications into provided xml template . . ; new on the market, compounded, or is a fake drug [blue pill]. . . ; To protect against failure, I will put an if/else block . . N VUID,RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER - . . I NDFIEN D + . . I NDFIEN,$D(^C0CRXN) D ; $Data is for Systems that don't have our RxNorm file yet. . . . S VUID=$$GET1^DIQ(50.68,VAPROD,99.99) . . . S RXNIEN=$$FIND1^DIC(176.001,,,VUID,"VUID") . . . S RXNORM=$$GET1^DIQ(176.001,RXNIEN,.01) diff --git a/p/CCRMEDS6.m b/p/CCRMEDS6.m index 1d067df..59c907d 100644 --- a/p/CCRMEDS6.m +++ b/p/CCRMEDS6.m @@ -75,13 +75,56 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE . ; Provider only provided in API as text, not DUZ. . ; We need to get DUZ from filman file 52 (Prescription) . ; Field 4;; IEN is Piece 1 of Meds stripped of trailing characters. - . S @MAP@("MEDSOURCEACTORID")="ACTORPROVIDER_"_$$GET1^DIQ(52,+$P(MEDS(MEDCNT),U),4,"I") + . N RXIEN S RXIEN=+$P(MEDS(MEDCNT),U) + . S @MAP@("MEDSOURCEACTORID")="ACTORPROVIDER_"_$$GET1^DIQ(52,RXIEN,4,"I") . S @MAP@("MEDPRODUCTNAMETEXT")=$P(MEDS(MEDCNT),U,3) - . ; Here we get the RxNorm information - . S @MAP@("MEDPRODUCTNAMECODEVALUE")=MED(27) - . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")="NDC" - . S @MAP@("MEDPRODUCTNAMECODEVERSION")="none" - . S @MAP@("MEDBRANDNAMETEXT")=MED(6.5) + . ; --- RxNorm Stuff + . ; 176.001 is the file for Concepts; 176.003 is the file for + . ; sources (i.e. for RxNorm Version) + . ; + . ; I use 176.001 for the Vista version of this routine (files 1-3) + . ; Since IHS does not have VUID's, I will be getting RxNorm codes + . ; using NDCs. My specially crafted index (sounds evil) named "NDC" + . ; is in file 176.002. The file is called RxNorm NDC to VUID. + . ; Except that I don't need the VUID, but it's there if I need it. + . ; + . ; We obviously need the NDC. That is easily obtained from the prescription. + . ; Field 27 in file 52 + . ; N NDC S NDC=$$GET1^DIQ(52,RXIEN,27,"I") + . ; S NDC=$TR(NDC,"-") ; Remove dashes + . ; NDC="0"_NDC ; Add an extra zero to front; don't ask, that's how RxNorm has it + . N NDC S NDC=0 ; TODO:Remove this line after I fix the RxNorm 176.002 file. + . N RXNIEN,RXNORM,SRCIEN,RXNNAME,RXNVER + . I +NDC,$D(^C0CRXN) D ; $Data is for Systems that don't have our RxNorm file yet. + . . S RXNIEN=$$FIND1^DIC(176.002,,,NDC,"NDC") + . . S RXNORM=$$GET1^DIQ(176.002,RXNIEN,.01) + . . S SRCIEN=$$FIND1^DIC(176.003,,"B","RXNORM") + . . S RXNNAME=$$GET1^DIQ(176.003,SRCIEN,6) + . . S RXNVER=$$GET1^DIQ(176.003,SRCIEN,7) + . ; + . E S (RXNORM,RXNNAME,RXNVER)="" + . ; End if/else block + . S @MAP@("MEDPRODUCTNAMECODEVALUE")=RXNORM + . S @MAP@("MEDPRODUCTNAMECODINGINGSYSTEM")=RXNNAME + . S @MAP@("MEDPRODUCTNAMECODEVERSION")=RXNVER + . ; --- End RxNorm section + . ; + . ; Brand name is 52 field 6.5 + . S @MAP@("MEDBRANDNAMETEXT")=$$GET1^DIQ(52,RXIEN,6.5,"I") + . ; + . ; Next I need Med Form (tab, cap etc), strength (250mg) + . ; concentration for liquids (250mg/mL) + . ; Since IHS does not have any of the new calls that + . ; Vista has, I will be doing a crosswalk: + . ; File 52, field 6 is Drug IEN in file 50 + . ; File 50, field 22 is VA Product IEN in file 50.68 + . ; In file 50.68, I will get the following: + . ; -- 1: Dosage Form + . ; -- 2: Strength + . ; -- 3: Units + . ; -- 8: Dispense Units + . ; -- Conc is 2 concatenated with 3 + . ; . N MEDIEN S MEDIEN=$P(MED(6),U) . D DOSE^PSS50(MEDIEN,,,,,"DOSE") . N DOSEDATA M DOSEDATA=^TMP($J,"DOSE",MEDIEN) @@ -105,7 +148,6 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE . 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.