Changeset 1623 for fmts/trunk/p
- Timestamp:
- May 6, 2013, 1:04:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XPT3.m
r1619 r1623 1 C0XPT3 ;ISI/MLS,VEN/SMH -- MEDS IMPORT ;2013-0 4-19 5:42 PM1 C0XPT3 ;ISI/MLS,VEN/SMH -- MEDS IMPORT ;2013-05-06 10:21 AM 2 2 ;;1.0;FILEMAN TRIPLE STORE;;Jun 26,2012;Build 29 3 3 ; (C) Sam Habiel 2013 … … 237 237 S DIC="^PS(52.5,",DIC(0)="L",DLAYGO=52.5,DIC("DR")=".02///"_FDT_";.03////"_$P(^PSRX(PSOIEN,0),"^",2)_";.04////"_TYPE_";.05///0;.06////"_DIV_";2///0" K DD,D0 D FILE^DICN K DD,D0 238 238 Q 239 ;240 ADDDRUG(RXN,NDC,BARCODE) ; Public Proc; Add Drug to Drug File241 ; Input: RXN - RxNorm Semantic Clinical Drug CUI by Value. Required.242 ; Input: NDC - Drug NDC by Value. Optional. Pass in 11 digit format without dashes.243 ; Input: BARCODE - Wand Barcode. Optional. Pass exactly as wand reads minus control characters.244 ; Output: None.245 ;246 ; Prelim Checks247 I '$G(RXN) S $EC=",U1," ; Required248 I $L($G(NDC)),$L(NDC)'=11 S $EC=",U1,"249 ;250 N PSSZ S PSSZ=1 ; Needed for the drug file to let me in!251 ;252 ; If RXN refers to a brand drug, get the generic instead.253 I $$ISBRAND^C0CRXNLK(RXN) S RXN=$$BR2GEN^C0CRXNLK(RXN)254 W !,"(debug) RxNorm is "_RXN,!255 ;256 ; Get first VUID for this RxNorm drug257 N VUID S VUID=+$$RXN2VUI^C0CRXNLK(RXN)258 Q:'VUID259 W "(debug) VUID for RxNorm CUI "_RXN_" is "_VUID,!260 ;261 ; IEN in 50.68262 N C0XVUID ; For Searching Compound Index263 S C0XVUID(1)=VUID264 S C0XVUID(2)=1265 N F5068IEN S F5068IEN=$$FIND1^DIC(50.68,"","XQ",.C0XVUID,"AMASTERVUID")266 Q:'F5068IEN267 W "F 50.68 IEN (debug): "_F5068IEN,!268 ;269 ; FDA Array270 N C0XFDA271 ;272 ; Name, shortened273 S C0XFDA(50,"+1,",.01)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,40)274 ;275 ; File BarCode as a Synonym for BCMA276 I $L($G(BARCODE)) D277 . S C0XFDA(50.1,"+2,+1,",.01)=BARCODE278 . S C0XFDA(50.1,"+2,+1,",1)="Q"279 ;280 ; Brand Names281 N BNS S BNS=$$RXN2BNS^C0CRXNLK(RXN) ; Brands282 I $L(BNS) N I F I=1:1:$L(BNS,U) D283 . N IENS S IENS=I+2284 . S C0XFDA(50.1,"+"_IENS_",+1,",.01)=$$UP^XLFSTR($E($P(BNS,U,I),1,40))285 . S C0XFDA(50.1,"+"_IENS_",+1,",1)="T"286 ;287 ; NDC (string)288 I $G(NDC) S C0XFDA(50,"+1,",31)=$E(NDC,1,5)_"-"_$E(NDC,6,9)_"-"_$E(NDC,10,11)289 ;290 ; Dispense Unit (string)291 S C0XFDA(50,"+1,",14.5)=$$GET1^DIQ(50.68,F5068IEN,"VA DISPENSE UNIT")292 ;293 ; National Drug File Entry (pointer to 50.6)294 S C0XFDA(50,"+1,",20)="`"_$$GET1^DIQ(50.68,F5068IEN,"VA GENERIC NAME","I")295 ;296 ; VA Product Name (string)297 S C0XFDA(50,"+1,",21)=$E($$GET1^DIQ(50.68,F5068IEN,.01),1,70)298 ;299 ; PSNDF VA PRODUCT NAME ENTRY (pointer to 50.68)300 S C0XFDA(50,"+1,",22)="`"_F5068IEN301 ;302 ; DEA, SPECIAL HDLG (string)303 D ; From ^PSNMRG304 . N CS S CS=$$GET1^DIQ(50.68,F5068IEN,"CS FEDERAL SCHEDULE","I")305 . S CS=$S(CS?1(1"2n",1"3n"):+CS_"C",+CS=2!(+CS=3)&(CS'["C"):+CS_"A",1:CS)306 . S C0XFDA(50,"+1,",3)=CS307 ;308 ; NATIONAL DRUG CLASS (pointer to 50.605) (triggers VA Classification field)309 S C0XFDA(50,"+1,",25)="`"_$$GET1^DIQ(50.68,F5068IEN,"PRIMARY VA DRUG CLASS","I")310 ;311 ; Right Now, I don't file the following which ^PSNMRG does (cuz I don't need them)312 ; - Package Size (derived from NDC/UPN file)313 ; - Package Type (ditto)314 ; - CMOP ID (from $$PROD2^PSNAPIS)315 ; - National Formulary Indicator (from 50.68)316 ;317 ; Next Step is to kill Old OI if Dosage Form doesn't match318 ; Won't do that here as it's assumed any drugs that's added is new.319 ; This happens at ^PSNPSS320 ;321 ; Next Step: Kill off old doses and add new ones. We need to to that.322 ; TODO: Add doses. Happens at EN1^PSSUTIL.323 N C0XERR,C0XIEN324 D UPDATE^DIE("E","C0XFDA","C0XIEN","C0XERR")325 ;326 S:$D(C0XERR) $EC=",U1,"327 ;328 QUIT C0XIEN(1)
Note:
See TracChangeset
for help on using the changeset viewer.