[1395] | 1 | VWPSSXPD ; VW/SMH - Update the Drug File and friends... ; Wed Apr 12 2012
|
---|
| 2 | ;;WorldVista Modifications;1.0
|
---|
| 3 | ; (C) Sam Habiel
|
---|
| 4 | ; Licensed under AGPL
|
---|
| 5 | ;
|
---|
| 6 | ; This routine contains utilities to remove a drug file and install a new drug file in VISTA.
|
---|
| 7 | ; Workflow:
|
---|
| 8 | ; 1. Call KILLDRUG to remove all Drug Data
|
---|
| 9 | ; 2. Restore a global containing a Drug File (^PSDRUG) and Pharmacy Orderable Item file (^PS(50.6)). Can use a KIDS global transport.
|
---|
| 10 | ; 3. Call RESTOCK to sync CPRS files back with drug files.
|
---|
| 11 | ;
|
---|
| 12 | ; PEPs: KILLDRUG to remove all Drugs
|
---|
| 13 | ; RESTOCK to add the drugs back to CPRS
|
---|
| 14 | ;
|
---|
| 15 | ;
|
---|
| 16 | KILLDRUG ; Remove all Drug Data. Public Entry Point. Use this to call the routine.
|
---|
| 17 | D DT^DICRW ; Min FM Vars
|
---|
| 18 | D EN^DDIOL("Killing Drug File (50)") D DRUG
|
---|
| 19 | D EN^DDIOL("Killing Pharmacy Orderable Items (50.7)") D PO
|
---|
| 20 | D EN^DDIOL("Removing Pharmacy Orderable Items from the Orderable Item file (101.43)") D O
|
---|
| 21 | D EN^DDIOL("Syncing the Order Quick View file (101.44)") D CPRS
|
---|
| 22 | QUIT
|
---|
| 23 | ;
|
---|
| 24 | RESTOCK ; Restock CPRS Orderable Items from new Drug & Pharmacy Orderable Item File. Public Entry Point. Call this after repopulating the drug file (50) and the pharmacy orderable item file (50.7)
|
---|
| 25 | N PSOIEN ; Looper variable
|
---|
| 26 | D DT^DICRW ; Establish FM Basic Variables
|
---|
| 27 | ;
|
---|
| 28 | ; Loop through Orderable Item file and call the protocol file updater to CPRS Files
|
---|
| 29 | S PSOIEN=0 F S PSOIEN=$O(^PS(50.7,PSOIEN)) Q:'PSOIEN D
|
---|
| 30 | . D EN^DDIOL("Updating Pharamcy Orderable Item "_PSOIEN)
|
---|
| 31 | . D EN^PSSPOIDT(PSOIEN),EN2^PSSHL1(PSOIEN,"MUP")
|
---|
| 32 | D CPRS ; Update Orderable Item View files
|
---|
| 33 | QUIT
|
---|
| 34 | ;
|
---|
| 35 | DRUG ; Kill Drug File; Private
|
---|
| 36 | N %1 S %1=^PSDRUG(0)
|
---|
| 37 | K ^PSDRUG
|
---|
| 38 | S ^PSDRUG(0)=%1
|
---|
| 39 | S $P(^PSDRUG(0),"^",3,4)=""
|
---|
| 40 | QUIT
|
---|
| 41 | ;
|
---|
| 42 | PO ; Kill Pharmacy Orderable Items; Private
|
---|
| 43 | N %1 S %1=^PS(50.7,0)
|
---|
| 44 | K ^PS(50.7)
|
---|
| 45 | S ^PS(50.7,0)=%1
|
---|
| 46 | S $P(^PS(50.7,0),"^",3,4)=""
|
---|
| 47 | QUIT
|
---|
| 48 | ;
|
---|
| 49 | O ; Kill off Pharamcy Order Items (Only!) in the Orderable Item file; Private
|
---|
| 50 | N DA ; Used in For loop below
|
---|
| 51 | N DIK S DIK="^ORD(101.43,"
|
---|
| 52 | N I S I=0
|
---|
| 53 | FOR S I=$O(^ORD(101.43,"ID",I)) QUIT:I="" DO
|
---|
| 54 | . I I["PSP" S DA=$O(^ORD(101.43,"ID",I,"")) D ^DIK
|
---|
| 55 | QUIT
|
---|
| 56 | ;
|
---|
| 57 | CPRS ; Now, update the CPRS lists (sync with Orderable Item file) - Uses a CPRS API to do this; Private
|
---|
| 58 | ; Next 3 variables are required as inputs
|
---|
| 59 | N ATTEMPT S ATTEMPT=0 ; Attempt to Update
|
---|
| 60 | N UPDTIME S UPDTIME=$HOROLOG ; Update Time
|
---|
| 61 | N DGNM ; Dialog Name
|
---|
| 62 | ; IVA RX -> Additives; IVB RX -> Solutions
|
---|
| 63 | ; IVM RX -> Inpatient Meds for Outpatients
|
---|
| 64 | ; NV RX -> Non-VA Meds ; O RX -> Outpatient
|
---|
| 65 | ; UD RX -> Unit Dose
|
---|
| 66 | FOR DGNM="IVA RX","IVB RX","IVM RX","NV RX","O RX","UD RX" DO
|
---|
| 67 | . D EN^DDIOL("Rebuilding "_DGNM)
|
---|
| 68 | . D FVBLD^ORWUL
|
---|
| 69 | QUIT
|
---|
| 70 | ;
|
---|