Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APSPRCUI

APSPRCUI.m

Go to the documentation of this file.
  1. APSPRCUI ;MSC/JS QUERY APELON FOR RXNORM VALUE FOR DRUG NDC OR DRUG VUID ;11-Oct-2013 13:15;DU
  1. ;;7.0;IHS PHARMACY MODIFICATIONS;**1017**;Sep 23, 2004;Build 40
  1. ;
  1. ; TAGS:
  1. ; LIST - List Drug file #50 entry RXNorm field
  1. ; QUERY - Query Apelon site for selected Drug file entry, defaults to NDC code, or VUID (if it exists)
  1. ; UPONE - Set Drug file entry RXCUI field with Apelon RXNorm value returned, or manually entered
  1. ; UPALL - Set All Drug file entries RXCUI field with Apelon RXNorm value returned
  1. ; QRXNORM - Query Drug file entry passing parameter IEN50
  1. ; SQUERY - API called from PSSCOMMON input template to add RXNORM code for new Drug file entry
  1. ; SUPALL - Tasked Set All Drug file entries RXCUI field with Apelon RXNorm value returned
  1. ; ONEUP - Menu option - Set Drug file entry RXCUI field with Apelon RXNorm value returned, or manually entered
  1. ;
  1. Q ; -- interactive use call tag MAIN
  1. ;
  1. MAIN ;
  1. I $G(DUZ)="" S DUZ=.5,DUZ(0)="@"
  1. S U="^" D HOME^%ZIS
  1. S $P(LINE,"-",80)=""
  1. D NDC
  1. S NOWI=$$NOW^XLFDT S Y=NOWI X ^DD("DD") S NOWE=Y
  1. NEW DIR,X,Y
  1. K DIR,X,Y
  1. S DIR(0)="S^Q:Query;L:List File RXNorm Codes (STATS);O:Update One RXNorm Entry;A:Update ALL RXNorm Entries;X:Exit"
  1. S DIR("B")="X"
  1. W ! D ^DIR
  1. G EXIT:Y=0!($D(DIRUT))
  1. I Y="L" D LIST G MAIN
  1. I Y="Q" D QUERY G MAIN
  1. I Y="O" D UPONE G MAIN
  1. I Y="A" D UPALL G MAIN
  1. I Y="X" G EXIT
  1. G EXIT
  1. ;
  1. LIST ;
  1. NEW DIR,X,Y
  1. S DIR(0)="Y",DIR("A")="List the Drug File RXNorm data",DIR("B")="Y"
  1. W ! D ^DIR
  1. G EXIT:Y=0!($D(DIRUT))
  1. I Y=1 D
  1. .W @IOF,!!,"DRUG FILE RXNORM LIST",?50,"DATE: ",NOWE,!,LINE,!,"DRUG"
  1. .NEW IEN50
  1. .S (IEN50,TOTAL,TOTRXY,TOTRXN,TOTNDCY,TOTNDCN)=0
  1. .F S IEN50=$O(^PSDRUG(IEN50)) Q:IEN50="" D
  1. ..Q:'$D(^PSDRUG(IEN50,0))
  1. ..NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. ..NEW NDC S NDC=$$GET1^DIQ(50,IEN50,31,"E")
  1. ..NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E")
  1. ..I $G(RXNORM)]"" S TOTRXY=TOTRXY+1
  1. ..I $G(RXNORM)="" S TOTRXN=TOTRXN+1
  1. ..I $G(NDC)]"" S TOTNDCY=TOTNDCY+1
  1. ..I $G(NDC)="" S TOTNDCN=TOTNDCN+1
  1. ..W !,"DRUG: ",DRUGNM
  1. ..W !?5,"NDC: ",NDC,?35,"RXNorm: ",RXNORM
  1. ..S TOTAL=TOTAL+1
  1. ..Q
  1. W !!,"TOTAL DRUG ENTRIES WITH RXNORM CODES: ",TOTRXY
  1. W !,"TOTAL DRUG ENTRIES WITH NO RXNORM CODES: ",TOTRXN
  1. W !,"TOTAL DRUG ENTRIES WITH NDC CODES: ",TOTNDCY
  1. W !,"TOTAL DRUG ENTRIES WITH NO NDC CODES: ",TOTNDCN
  1. W !!,"TOTAL DRUG ENTRIES: ",TOTAL
  1. Q
  1. ;
  1. QUERY ;
  1. NEW DIR,X,Y,IEN50
  1. S DIR(0)="P^50:EMZ",DIR("A")="Enter DRUG file entry"
  1. W ! D ^DIR
  1. Q:$D(DIRUT)
  1. S IEN50=+Y
  1. Q:'$D(^PSDRUG(IEN50,0))
  1. NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. NEW NDC S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. W !,"DRUG: ",DRUGNM,!,?30,"NDC:",?40,NDC,!?30,"RXNorm:",?40,RXNORM
  1. Q
  1. ; -- if APSPDIS parameter set, make a 'quiet' call
  1. SQUERY(IEN50,APSPDIS) ;
  1. N RXNORM,NDC,NDCPAR
  1. S RXNORM=""
  1. I '$D(^PSDRUG(IEN50,0))="" Q ""
  1. D NDC
  1. I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. .S NDC=$$NDC^APSPES4(IEN50)
  1. .S:NDC="" NDC="NONE"
  1. I NDC="NONE" Q "-1^NDC not found for DRUG entry"
  1. NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. NEW NDCAP S NDCAP=NDC
  1. S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E")
  1. D APELON(.RXNORM)
  1. Q RXNORM
  1. ;
  1. ; -- KIDS Post-Install Update - Queued update for all Drug file entries
  1. SUPALL ;
  1. N APSPARR
  1. S APSPARR(1)=""
  1. S APSPARR(2)="Checking the Apelon utility installation..."
  1. S APSPARR(3)=""
  1. D MES^XPDUTL(.APSPARR) K APSPARR
  1. ;
  1. NEW APELYES S APELYES=$$TEST^CIAUOS("DI2RX^BSTSAPI")
  1. ;
  1. N APSPARR
  1. S APSPARR(1)=""
  1. I APELYES S APSPARR(2)="Tasking DRUG File #50 RXCUI field update..."
  1. E S APSPARR(2)="The Apelon utility has not been installed, aborting update..."
  1. S APSPARR(3)=""
  1. D MES^XPDUTL(.APSPARR) K APSPARR
  1. Q:APELYES=0
  1. ;-- schedule TM job to run 'NOW' --
  1. S ZTIO=""
  1. ;S ZTDTH=$H
  1. S ZTRTN="DQ^APSPRCUI"
  1. S ZTDESC="Tasked Update FILE #50 'RXCUI' field from KIDs build "_$G(XPDNM)
  1. I $G(XPDNM)]"" S ZTSAVE("XPDNM")=""
  1. D ^%ZTLOAD K IO("Q")
  1. D HOME^%ZIS
  1. N APSPARR
  1. S APSPARR(1)=""
  1. S APSPARR(2)="The update for DRUG file field RXCUI"_$S($G(ZTSK)]"":" is tasked #"_ZTSK,1:" has NOT been tasked")
  1. S APSPARR(3)=""
  1. D MES^XPDUTL(.APSPARR) K APSPARR
  1. K ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
  1. Q
  1. ;
  1. NDC ; -- check XPAR parameter APSP RXNORM NDC LOOKUP for NDC lookup method, default value is 'P' - VA PRODUCT NDC lookup
  1. S NDCDIV=$$GET^XPAR("DIV","APSP RXNORM NDC LOOKUP")
  1. S NDCSYS=$$GET^XPAR("SYS","APSP RXNORM NDC LOOKUP")
  1. I NDCDIV="" S NDCPAR=NDCSYS S:NDCPAR="" NDCPAR="P" Q
  1. I NDCDIV]"" D
  1. .I $G(DUZ(2))="" S NDCPAR=NDCSYS S:NDCPAR="" NDCPAR="P" Q
  1. .NEW XPIEN
  1. .S XPIEN="",XPIEN=$O(^XTV(8989.51,"B","APSP RXNORM NDC LOOKUP",XPIEN))
  1. .I XPIEN="" S NDCPAR="P" Q
  1. .NEW XPAC,FLG
  1. .S XPAC=""
  1. .S FLG=0
  1. .F S XPAC=$O(^XTV(8989.5,"AC",XPIEN,XPAC)) Q:XPAC=""!(FLG=1) D
  1. ..I XPAC[";DIC(4," I XPAC[$G(DUZ(2)) S NDCPAR=NDCDIV,FLG=1 Q
  1. .S:$G(NDCPAR)="" NDCPAR=NDCSYS S:NDCPAR="" NDCPAR="P"
  1. Q
  1. ;
  1. TMPGBL(X) ;EP
  1. K ^TMP("APSPRCUI",$J) Q $NA(^($J))
  1. ;
  1. DQ ; -- tasked update from KIDs Post-Install for ALL Drug file entries job starts here
  1. S APSPDIS=1 ; -- skip the Apelon call dialog
  1. D NDC
  1. NEW IEN50,RXNORM
  1. S IEN50=0,RXNORM=""
  1. F S IEN50=$O(^PSDRUG(IEN50)) Q:IEN50="" D
  1. .Q:'$D(^PSDRUG(IEN50,0))
  1. .I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. .E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. .I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. ..S NDC=$$NDC^APSPES4(IEN50)
  1. ..S:NDC="" NDC="NONE"
  1. .I NDC="NONE" Q
  1. .NEW NDCAP S NDCAP=NDC
  1. .D APELON(RXNORM)
  1. K APSPDIS,NDC,NDCDIV,NDCPAR,NDCSYS
  1. Q
  1. ;
  1. UPONE ;
  1. W @IOF,!!
  1. W !,"This option will update a DRUG file entry RXNorm field using the Apelon Tool",!,"or alternatively by data entry.",!
  1. NEW DIR,X,Y
  1. K DIR,X,Y
  1. S DIR(0)="Y",DIR("A")="Do you want to update the Drug File RXNorm data using the Apelon Tool",DIR("B")="Y"
  1. S DIR("?")="Enter 'NO' to manually enter the RXNorm data, or '^' to quit."
  1. W ! D ^DIR
  1. Q:$D(DIRUT)
  1. S USEAP=Y
  1. I USEAP I '$$TEST^CIAUOS("DI2RX^BSTSAPI") W !!,"The Apelon utility has not been installed on this account, aborting update." Q
  1. K DIR,X,Y
  1. S DIR(0)="P^50:EMZ",DIR("A")="Enter DRUG file entry"
  1. W ! D ^DIR
  1. Q:$D(DIRUT)
  1. K IEN50 S IEN50=+Y
  1. Q:'$D(^PSDRUG(IEN50,0))
  1. D NDC
  1. W:'USEAP !!,$S(NDCPAR="L":"Using local DRUG file NDC data...",1:"Using VA PRODUCT file NDC data...")
  1. W:USEAP !!,$S(NDCPAR="L":"Using local DRUG file NDC data for Apelon query...",1:"Using VA PRODUCT file NDC value used for Apelon query...")
  1. NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. NEW NDC
  1. I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. .W !,"Local NDC field not set, alternately using NDC code from VA PRODUCT file...",!
  1. .S NDC=$$NDC^APSPES4(IEN50)
  1. S:NDC="" NDC="NONE"
  1. NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. W !,DRUGNM,?55,NDC
  1. I USEAP I NDC="NONE" W !!,"No NDC code found for this entry, cannot query Apelon for update.",! Q
  1. NEW NDCAP S NDCAP=NDC
  1. I 'USEAP D FLDEDIT(IEN50)
  1. I USEAP D APELON(RXNORM)
  1. Q
  1. ;
  1. UPALL ;
  1. I '$$TEST^CIAUOS("DI2RX^BSTSAPI") W !!,"The Apelon utility has not been installed on this account, aborting update." Q
  1. NEW DIR,X,Y
  1. K DIR,X,Y
  1. S DIR(0)="Y",DIR("A")="Update the Drug File RXNorm data for ALL entries",DIR("B")="Y"
  1. W ! D ^DIR
  1. G EXIT:Y=0!($D(DIRUT))
  1. D NDC
  1. NEW IEN50
  1. S IEN50=0
  1. F S IEN50=$O(^PSDRUG(IEN50)) Q:IEN50="" D
  1. .Q:'$D(^PSDRUG(IEN50,0))
  1. .NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. .W !!,$S(NDCPAR="L":"Checking local DRUG file NDC data for Apelon query...",1:"VA PRODUCT file NDC value used for Apelon query...")
  1. .NEW NDC
  1. .I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. .E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. .I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. ..W !,"Local NDC field not set, alternately using NDC code from VA PRODUCT file...",!
  1. ..S NDC=$$NDC^APSPES4(IEN50)
  1. .S:NDC="" NDC="NONE"
  1. .NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. .I NDC="NONE" W !,"Skipping entry ",DRUGNM," no NDC code",! Q
  1. .W !,DRUGNM,?55,NDC
  1. .NEW NDCAP S NDCAP=NDC
  1. .D APELON(RXNORM)
  1. Q
  1. ; Query DRUG file entry, returns IEN ^ Drug Name ^ NDC Code ^ RXNorm
  1. ; Input = DRUG file #50 IEN
  1. QRXNORM(RET,IEN50) ;
  1. I $G(IEN50)="" Q "-1^Missing Drug file #50 IEN parameter"
  1. I '$D(^PSDRUG(IEN50,0))="" Q ""
  1. NEW INFO50
  1. S INFO50=0
  1. D NDC
  1. I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. .S NDC=$$NDC^APSPES4(IEN50)
  1. .S:NDC="" NDC="NONE"
  1. NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. S INFO50=$G(IEN50)_U_$G(DRUGNM)_U_$G(NDC)_U_$G(RXNORM)
  1. Q INFO50
  1. ;
  1. FLDEDIT(IEN50) ; -- update RXCUI field with data entry
  1. NEW DIR,X,Y,RXCUI
  1. K DIR,X,Y
  1. S DIR(0)="N^1:9999999",DIR("A")="Enter the RXNorm numeric code"
  1. W ! D ^DIR
  1. Q:$D(DIRUT)
  1. S RXCUI=Y
  1. NEW DA,DIE,DR,X,Y
  1. K DA,DIE,DR,X,Y
  1. S DA=IEN50
  1. S DIE="^PSDRUG("
  1. S DR="9999999.27///^S X=RXCUI"
  1. D ^DIE
  1. S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. W !,$S(RXNORM=RXCUI:"ENTRY UPDATED",1:"ENTRY *NOT* UPDATED")
  1. I RXNORM=RXCUI W " - RXCUI field set to: ",RXNORM
  1. Q
  1. ;
  1. APELON(RXNORM) ; -- query Apelon site for drug NDC code, if RXCUI data returned updated DRUG file entry(s)
  1. ; -- if $G(APSPDIS)="", display dialog
  1. N NDCAPL,RXCUI,IN,ZDATA,UPOK,VUID,VUIDOK
  1. S RXNORM=""
  1. Q:$G(NDCAP)=""
  1. S UPOK=0
  1. S NDCAP=$$STRIP^XLFSTR(NDCAP,"-")
  1. S NDCAPL=$L(NDCAP) I NDCAPL>11 I $E(NDCAP,1)=0 S NDCAP=$E(NDCAP,2,999) ; strip off leading 0
  1. W:$G(APSPDIS)="" !,"Querying Apelon site..."
  1. S IN=NDCAP_"^N" S ZDATA=$$DI2RX^BSTSAPI(IN)
  1. I ZDATA="" D
  1. .W:$G(APSPDIS)="" "NDC query failed, trying VUID query..."
  1. .D VUID
  1. .I VUIDOK=0 W:$G(APSPDIS)="" !,"VUID code not onfile, skipping entry"
  1. .I VUIDOK=1 D
  1. ..;Input (from DI2RX^BSTSAPIF)
  1. ..; IN - P1 - The exact term to lookup
  1. ..; - P2 - Lookup Type (N-NDC,V-VUID)
  1. ..S IN=VUID_"^V" S ZDATA=$$DI2RX^BSTSAPI(IN)
  1. ;First try for trade name (3rd piece), if not there use the data in field 1
  1. S RXCUI=$P(ZDATA,U,3)
  1. S TTY=$P(ZDATA,U,5)
  1. I RXCUI="" S RXCUI=$P(ZDATA,U,1)
  1. I $G(RXCUI)]"" S UPOK=1
  1. I UPOK=0 Q
  1. I UPOK=1 D
  1. .NEW DA,DIE,DR,X,Y
  1. .S DA=IEN50
  1. .S DIE="^PSDRUG("
  1. .S DR="9999999.27///^S X=RXCUI"
  1. .D ^DIE
  1. .S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. .W:$G(APSPDIS)="" $S(RXNORM=RXCUI:"ENTRY UPDATED",1:"ENTRY *NOT* UPDATED")
  1. .I RXNORM=RXCUI W:$G(APSPDIS)="" " - RXCUI field set to: ",RXNORM
  1. .S RXNORM=RXCUI_U_TTY
  1. Q
  1. ;
  1. VUID ; -- alternate Drug VUID lkup here if no NDC available
  1. S VUIDOK=0
  1. N VAPNAME,NDNODE,PSNF
  1. S NDNODE=$G(^PSDRUG(IEN50,"ND")),VAPNAME=$P(NDNODE,U,2)
  1. Q:VAPNAME=""
  1. S PSNF="",PSNF=$O(^PSNDF(50.68,"B",VAPNAME,PSNF))
  1. Q:PSNF=""
  1. N VUIDND,VUIDMSTR
  1. S VUIDND=$G(^PSNDF(50.68,PSNF,"VUID"))
  1. Q:VUIDND=""
  1. S VUID=$P(VUIDND,U,1),VUIDMSTR=$P(VUIDND,U,2)
  1. Q:VUID=""!(VUIDMSTR="")
  1. I VUIDMSTR=1 I $L(VUID)=7 S VUIDOK=1
  1. Q
  1. ;
  1. ONEUP ; -- XQ menu option to update RXNorm field for DRUG file entry
  1. S U="^" D HOME^%ZIS
  1. NEW USEAP,IEN50,NDC,NDCDIV,NDCSYS,NDCPAR,DRUGNM
  1. W @IOF,!!
  1. W !,"This option will update a DRUG file entry RXNorm field using the Apelon Tool",!,"or alternatively by data entry.",!
  1. NEW DIR,X,Y
  1. K DIR,X,Y
  1. S DIR(0)="Y",DIR("A")="Do you want to update the Drug File RXNorm data using the Apelon Tool",DIR("B")="Y"
  1. S DIR("?")="Enter 'NO' to manually enter the RXNorm data, or '^' to quit."
  1. W ! D ^DIR
  1. G EXIT:$D(DIRUT)
  1. S USEAP=Y
  1. I USEAP I '$$TEST^CIAUOS("DI2RX^BSTSAPI") W !!,"The Apelon utility has not been installed on this account, aborting update." G EXIT
  1. K DIR,X,Y
  1. S DIR(0)="P^50:EMZ",DIR("A")="Enter DRUG file entry"
  1. W ! D ^DIR
  1. G EXIT:$D(DIRUT)
  1. K IEN50 S IEN50=+Y
  1. I '$D(^PSDRUG(IEN50,0)) W !!,"DRUG file entry not available for editing",! G ONEUP
  1. D NDC
  1. W:'USEAP !!,$S(NDCPAR="L":"Using local DRUG file NDC data...",1:"Using VA PRODUCT file NDC data...")
  1. W:USEAP !!,$S(NDCPAR="L":"Using local DRUG file NDC data for Apelon query...",1:"Using VA PRODUCT file NDC value used for Apelon query...")
  1. NEW DRUGNM S DRUGNM=$$GET1^DIQ(50,IEN50,.01,"E") S DRUGNM=DRUGNM_" ("_IEN50_")"
  1. NEW NDC
  1. I NDCPAR="P" S NDC=$$NDC^APSPES4(IEN50)
  1. E S NDC=$$GET1^DIQ(50,IEN50,31,"E") S:NDC="" NDC="NONE"
  1. I NDCPAR="L" I NDC="NONE" D ; alternate lookup NDC code from VA PRODUCT file when local NDC field #31 is null
  1. .W !,"Local NDC field not set, alternately using NDC code from VA PRODUCT file...",!
  1. .S NDC=$$NDC^APSPES4(IEN50)
  1. S:NDC="" NDC="NONE"
  1. NEW RXNORM S RXNORM=$$GET1^DIQ(50,IEN50,9999999.27,"E") S:RXNORM="" RXNORM="NONE"
  1. W !,DRUGNM,?55,NDC
  1. I USEAP I NDC="NONE" W !!,"No NDC code found for this entry, cannot query Apelon for update.",! G ONEUP
  1. NEW NDCAP S NDCAP=NDC
  1. I 'USEAP D FLDEDIT(IEN50)
  1. I USEAP D APELON(RXNORM)
  1. NEW DIR,X,Y
  1. S DIR(0)="E",DIR("A")="Press RETURN to continue" W !! D ^DIR
  1. G ONEUP
  1. ;
  1. EXIT ;
  1. K DIRUT,IN,LINE,NOWE,NOWI,TOTAL,TOTNDCY,TOTNDCN,TOTRXN,TOTRXY,VUIDOK,IEN50,ZDATA
  1. K APSPDIS,NDC,NDCAPL,UPOK,RXCUI,NDCDIV,NDCSYS,NDCPAR,USEAP
  1. Q
  1. ROUTES ;Enter old SNOMED medication routes
  1. N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,DIR
  1. S ZTRTN="UPROUTE^APSPRCUI",ZTIO="",ZTSAVE("DUZ")=""
  1. W !,"Tasking MEDICATION ROUTE #51.2 SNOMED CODE Update"
  1. S ZTDESC="Store SNOMED on med routes mapped to standard route file"
  1. D ^%ZTLOAD
  1. I $G(ZTSK) D
  1. .W !!,"A task has been queued in the background."
  1. .W !," The task number is "_$G(ZTSK)_"."
  1. Q
  1. UPROUTE ;Update local medication routes that are mapped
  1. N MEDIEN,PSSDMRNW,PSSMRNM,SNOMED,ZDATA,IN,ERR,FDA,IENS,FNUM
  1. S MEDIEN=0 F S MEDIEN=$O(^PS(51.2,MEDIEN)) Q:'+MEDIEN D
  1. .S PSSDMRNW=$P($G(^PS(51.2,MEDIEN,1)),"^")
  1. .Q:PSSDMRNW=""
  1. .S PSSMRNM=$P($G(^PS(51.23,PSSDMRNW,0)),"^")
  1. .S IN=PSSMRNM_"^32774" S ZDATA=$$ASSOC^BSTSAPI(IN)
  1. .S SNOMED=$P(ZDATA,U,1)
  1. .S FNUM=51.2
  1. .S IENS=MEDIEN_","
  1. .S FDA=$NA(FDA(FNUM,IENS))
  1. .S @FDA@(9999999.01)=SNOMED
  1. .D FILE^DIE("E","FDA","ERR")
  1. Q