Difference between revisions of "Pharmacy Issues"

From VistApedia
Jump to: navigation, search
(Files and Relationships)
(Files and Relationships)
 
(82 intermediate revisions by 6 users not shown)
Line 4: Line 4:
  
 
=== Keys Needed for Pharm. Setup ===
 
=== Keys Needed for Pharm. Setup ===
David Whitten searched pharmacy routines and found keys that were needed for some of the pharmacy setup routines.  Here are the keys that were found:
+
We searched pharmacy routines and found keys that were needed for some of the pharmacy setup routines.  Here are the keys that were found:
PSA ORDERS, PSAMGR, PSJ RPWARN, PSB MANAGER, PSB CPRS MED BUTTON, PSB INSTRUCTOR, PROVIDER, PSD TECH, PSDMGR, PSD BUMGR, PSD ERROR, PSD PARAM, PSD TRAN
+
[[SECURITY KEY PSA ORDERS|PSA ORDERS]], [[SECURITY KEY PSAMGR|PSAMGR]], [[SECURITY KEY PSJ RPWARN|PSJ RPWARN]], [[SECURITY KEY PSB MANAGER|PSB MANAGER]], [[SECURITY KEY PSB CPRS MED BUTTON|PSB CPRS MED BUTTON]], [[SECURITY KEY PSB INSTRUCTOR|PSB INSTRUCTOR]], [[SECURITY KEY PROVIDER|PROVIDER]], [[SECURITY KEY PSD TECH|PSD TECH]], [[SECURITY KEY PSDMGR|PSDMGR]], [[SECURITY KEY PSD BUMGR|PSD BUMGR]], [[SECURITY KEY PSD ERROR|PSD ERROR]], [[SECURITY KEY PSD PARAM|PSD PARAM]], [[SECURITY KEY PSD TRAN|PSD TRAN]]
  
 
----
 
----
  
 
=== Files and Relationships ===
 
=== Files and Relationships ===
*<b>VA PRODUCT</b> file (file #50.68, ^PSNDF(50.68,*)) holds ALL possible drugs.  Some people refer to this as the National Drug File. [[File Info #50.68]]
+
*<b>VA PRODUCT</b> file (file #50.68, ^PSNDF(50.68,*)) holds ALL possible drugs.  Some people refer to this as the National Drug File. [[FILE 50.68]]
*<b>DRUG</b> file (file #50, ^PSDRUG(*)) holds all the drugs in the local formulary. This links to above. [[File Info #50]]
+
*<b>VA GENERIC</b> file (file #50.6, ^PSNDF(50.6))
*<b>PHARMACY ORDERABLE ITEM</b> file (file #50.7, ^PS(50.7,*)) holds things that can be ordered from the pharmacy. This links to above. [[File Info #50-7]]
+
*<b>DRUG</b> file (file #50, ^PSDRUG(*)) holds all the drugs in the local formulary. This links to above. [[FILE 50]]
*<b>ORDERABLE ITEM</b> file (file #101.43, ^ORD(101.43,*)) holds things that can be ordered, including labs and drugs. This links to above. [[File Info #101-43]]
+
*<b>PHARMACY ORDERABLE ITEM</b> file (file #50.7, ^PS(50.7,*)) holds things that can be ordered from the pharmacy. This links to above. [[FILE 50.7]]
*<b>ORDER QUICK VIEW</b> file (file #101.44, ^ORD(101.44,*)) holds "quick order" entries. This links to above. [[File Info #101-44]]
+
*<b>ORDERABLE ITEM</b> file (file #101.43, ^ORD(101.43,*)) holds things that can be ordered, including labs and drugs. This links to above. [[FILE 101.43]]
 +
*<b>ORDER QUICK VIEW</b> file (file #101.44, ^ORD(101.44,*)) holds "quick order" entries. This links to above. [[FILE 101.44]]
 +
*<b>PENDING OUTPATIENT ORDERS</b> file (file #52.41, ^PS(52.41,*)) holds prescription requests entries, to be approved by pharmacist [[FILE 52.41]]
 +
*<b>PRESCRIPTION FILE</b> file (file #52, ^PSRX(*)) holds prescriptions [[FILE 52]]
  
 +
[[Summary of Pharmacy File Linkages]]
  
 
What I Have Learned so Far
 
What I Have Learned so Far
  
1. File 50.7 (PHARMACY ORDERABLE ITEM):
+
1. '''File 50.7 (PHARMACY ORDERABLE ITEM):'''
   **A record in this file should be created first.   
+
   **A [[record~|Record]] in this file should be created first.   
 
   .01 field should be the generic name of the drug.
 
   .01 field should be the generic name of the drug.
   When the record is created, an entry in fle 101.43 (ORDERABLE ITEM) will automatically be made.
+
   When the [[record~|Record]] is created, an entry in fle 101.43 (ORDERABLE ITEM) will automatically be made.
   Also, a record in in ORDER QUICK VIEW will also be created (but it is incomplete--see below.)
+
   Also, a [[record~|Record]] in in ORDER QUICK VIEW will also be created (but it is incomplete--see below.)
 
   Note: new drugs may not be added unless PSEDITNM>0.  So to setup a drug in fileman,
 
   Note: new drugs may not be added unless PSEDITNM>0.  So to setup a drug in fileman,
 
         set PSEDITNM=1 from the command-line, then DO D^DI to get into Fileman with vars intact.
 
         set PSEDITNM=1 from the command-line, then DO D^DI to get into Fileman with vars intact.
 
   In the MED ROUTE field, the input transform does not allow an input of "ORAL".  (If left
 
   In the MED ROUTE field, the input transform does not allow an input of "ORAL".  (If left
   blank ORAL will be shown in CPRS)
+
   blank ORAL will be shown in [[CPRS~|CPRS]])
  There is no direct link from file 50.7 up to file 50.  The link is FROM file #50 TO #50.7 (via
 
  file #50's field 2.1(PHARMACY ORDERABLE ITEM))
 
 
   This file can hold the synonyms of a drug etc.
 
   This file can hold the synonyms of a drug etc.
   When this record is created, for some reason it is automatically given the current
+
   When this [[record~|Record]] is created, for some reason it is automatically given the current
 
     date in the INACTIVE DATE field--meaning it is created in an inactive state.  One must
 
     date in the INACTIVE DATE field--meaning it is created in an inactive state.  One must
     go back and edit the record a second time to remove the entry from this field.
+
     go back and edit the [[record~|Record]] a second time to remove the entry from this field.
 +
  File 101.43 (ORDERABLE ITEM), field ID holds a text pointer to this file, e.g.
 +
  "10;99PSP" <---- 10 is IEN in file #50.7
 +
  There is no pointer field from file 50.7 up to file 50.  The link is FROM file #50
 +
  TO #50.7 (via file #50's field 2.1(PHARMACY ORDERABLE ITEM)).  HOWEVER, File #50's
 +
  "ASP" cross-reference for the field "PHARMACY ORDERABLE ITEM (#2.1) i.e.
 +
  ^PSDRUG("ASP",IEN_in_50.7,*), contains list of linked [[record~|Record]]s in file #50
 +
 
 
    
 
    
2. In file# 50 (DRUG, ^PSDRUG):
+
2. In '''file# 50 (DRUG, ^PSDRUG):'''
   This file will hold a separate record for every different medication/tablet size.
+
   This file will hold a separate [[record~|Record]] for every different medication/tablet size.
 
   For example, there will be one for AMOXICILLIN 250, and another for AMOXICILLIN 500.
 
   For example, there will be one for AMOXICILLIN 250, and another for AMOXICILLIN 500.
   Both of the above records would be linked to one record in the PHARMACY ORDERABLE ITEM,
+
   Both of the above [[record~|Record]]s would be linked to one [[record~|Record]] in the PHARMACY ORDERABLE ITEM,
   i.e. an AMOXICILLIN record.
+
   i.e. an AMOXICILLIN [[record~|Record]].
 
   The link should be in field 2.1 (the PHARMACY ORDERABLE ITEM field), which will
 
   The link should be in field 2.1 (the PHARMACY ORDERABLE ITEM field), which will
 
     hold a pointer to file 50.7 (PHARMACY ORDERABLE ITEM file)
 
     hold a pointer to file 50.7 (PHARMACY ORDERABLE ITEM file)
 
    
 
    
  (old, confused notes--best ignored)
+
3. In '''file 101.43 (ORDERABLE ITEM)''' an entry for the drug must exist like this:
  There must be an entry coresponding to the ID from 101.43, i.e. The "ASP"
 
  cross-reference for the field "PHARMACY ORDERABLE ITEM (#2.1) i.e. ^PSDRUG("ASP",+ID,*)
 
  should exist. 
 
 
 
3. In file 101.43 (ORDERABLE ITEM) an entry for the drug must exist like this:
 
 
   This entry should have been made automatically when the PHARMACY ORDERABLE ITEM was
 
   This entry should have been made automatically when the PHARMACY ORDERABLE ITEM was
 
   created.
 
   created.
 
    
 
    
 
   file 101.43
 
   file 101.43
   record: .01 NAME = LISINOPRIL
+
   [[record~|Record]]: .01 NAME = LISINOPRIL
 
             2 ID = "Unique identifier, created from primary key passed in the  
 
             2 ID = "Unique identifier, created from primary key passed in the  
 
                   Orderable Items update message from each package; it will be  
 
                   Orderable Items update message from each package; it will be  
Line 61: Line 65:
 
                   "Package code" should be the IEN on the PHARMACY ORDERABLE ITEM (#50.7)
 
                   "Package code" should be the IEN on the PHARMACY ORDERABLE ITEM (#50.7)
  
4. For meds to show up in the dialog box in CPRS, it must have a entry like this:
+
4. '''101.44 (ORDER QUICK VIEW)'''  For meds to show up in the dialog box in [[CPRS~|CPRS]], it must have a entry like this:
 
   Again, this entry should have been created automatically when the PHARMACY ORDERABLE ITEM
 
   Again, this entry should have been created automatically when the PHARMACY ORDERABLE ITEM
 
   was created.  But for some reason, the DISPLAY TEXT field is not filled in.  Without this,
 
   was created.  But for some reason, the DISPLAY TEXT field is not filled in.  Without this,
   the drug will not appear in CPRS.  So this must be manually supplied.
+
   the drug will not appear in [[CPRS~|CPRS]].  So this must be manually supplied.
  
 
  file: 101.44 (ORDER QUICK VIEW);   
 
  file: 101.44 (ORDER QUICK VIEW);   
   record: ORWDSET O RX;   
+
   [[record~|Record]]: ORWDSET O RX;   
 
     subfile: SET MEMBER (101.442)
 
     subfile: SET MEMBER (101.442)
       record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
+
       [[record~|Record]]: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
               DISPLAY TEXT: "A name to appear in CPRS appears here.
+
               DISPLAY TEXT: "A name to appear in [[CPRS~|CPRS]] appears here.
       record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
+
       [[record~|Record]]: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
               DISPLAY TEXT: "A name to appear in CPRS appears here.
+
               DISPLAY TEXT: "A name to appear in [[CPRS~|CPRS]] appears here.
       record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
+
       [[record~|Record]]: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
               DISPLAY TEXT: "A name to appear in CPRS appears here.
+
               DISPLAY TEXT: "A name to appear in [[CPRS~|CPRS]] appears here.
       record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
+
       [[record~|Record]]: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)  ... a drug would go here
               DISPLAY TEXT: "A name to appear in CPRS appears here.
+
               DISPLAY TEXT: "A name to appear in [[CPRS~|CPRS]] appears here.
  
 +
=== Example of Data===
 +
<pre>
 +
File 101.44 (ORDER QUICK VIEW)
 +
  .01-NAME : ORWDSET O RX
 +
    6-LAST UPDATE : 60414,61441
 +
    20-SET MEMBER :
 +
      -snip-
 +
      Multiple Entry #15  <--- notice that there are no doses
 +
      .01-SET MEMBER : SILDENAFIL TAB  <-- pointer to 101.43
 +
        2-DISPLAY TEXT : SILDENAFIL TAB
 +
      -snip-
 +
      Multiple Entry #17  <--- notice that there are no doses
 +
      .01-SET MEMBER : SILDENAFIL TAB  <-- pointer to 101.43
 +
        2-DISPLAY TEXT : VIAGRA    <SILDENAFIL TAB>
 +
      -snip-
 +
  ||
 +
  ||
 +
  \/
  
 +
File 101.43 (ORDERABLE ITEM)
 +
  .01-NAME : SILDENAFIL TAB
 +
    1-SYNONYMS :
 +
      Multiple Entry #1
 +
      .01-SYNONYM : VIAGRA
 +
  1.1-PACKAGE NAME : SILDENAFIL TAB
 +
    2-ID : 4;99PSP  <--- pointer to IEN=4 in 50.7
 +
    5-DISPLAY GROUP : PHARMACY
 +
    9-SET MEMBERSHIP :
 +
      Multiple Entry #1
 +
      .01-SET : RX
 +
  -snip-
 +
  ||
 +
  ||
 +
  \/
 +
 +
File 50.7 (PHARMACY ORDERABLE ITEM)
 +
  .01-NAME : SILDENAFIL
 +
  .02-DOSAGE FORM : TAB
 +
  .05-DAY (nD) or DOSE (nL) LIMIT : 2L
 +
  .07-SCHEDULE TYPE : FILL ON REQUEST
 +
    2-SYNONYM :
 +
      Multiple Entry #1
 +
      .01-SYNONYM : VIAGRA  <-- free text
 +
    7-PATIENT INSTRUCTIONS : [Do not take with nitroglycerin]
 +
  ||
 +
  ||
 +
  \/
 +
 +
ASP index in file 50 allows link from 50.7 --> 50
 +
^PSDRUG("ASP",4,7118) =  IEN# 4 in 50.7 --> IEN# 7118 in 50
 +
  ||
 +
  ||
 +
  \/
 +
 +
File 50 (DRUG file)  (some noncontributory fields edited)
 +
  .001-NUMBER : 7118
 +
  .01-GENERIC NAME : SILDENAFIL (Viagra) 50MG TAB
 +
  2.1-PHARMACY ORDERABLE ITEM : SILDENAFIL
 +
    9-SYNONYM :
 +
      Multiple Entry #2
 +
      .01-SYNONYM : VIAGRA
 +
        1-INTENDED USE : TRADE NAME
 +
  14.5-DISPENSE UNIT : TAB
 +
    20-NATIONAL DRUG FILE ENTRY : SILDENAFIL
 +
    21-VA PRODUCT NAME : SILDENAFIL CITRATE 50MG TAB
 +
    22-PSNDF VA PRODUCT NAME ENTRY : SILDENAFIL CITRATE 50MG TAB
 +
  101-MESSAGE : Use for 25mg dose only
 +
  215-QUANTITY DISPENSE MESSAGE : MAX 4 DOSE/MO-CONTRAINDICATED WITH NITRATES
 +
  901-STRENGTH : 50
 +
  902-UNIT : MG
 +
  903-POSSIBLE DOSAGES :
 +
      Multiple Entry #1
 +
      .01-DISPENSE UNITS PER DOSE : 1
 +
        2-PACKAGE : IO
 +
      Multiple Entry #2
 +
      .01-DISPENSE UNITS PER DOSE : .5
 +
        2-PACKAGE : O
 +
      Multiple Entry #3
 +
      .01-DISPENSE UNITS PER DOSE : 1
 +
        1-DOSE : 50
 +
        2-PACKAGE : IO
 +
      Multiple Entry #4
 +
      .01-DISPENSE UNITS PER DOSE : 2
 +
        1-DOSE : 100
 +
        2-PACKAGE : IO
 +
 +
 +
</pre>
 
----
 
----
  
 
=== Example Entry ===
 
=== Example Entry ===
 +
 +
Here is an example of entering the drug the "proper" way, via menu options:
 +
[[Drug Entry Edit Example]]
 +
 
Here is a sample inquirery of one successfuly added drug: furosemide
 
Here is a sample inquirery of one successfuly added drug: furosemide
(NOTICE: in this system, there is only 1 orderable drug from CPRS)
+
(NOTICE: in this system, there is only 1 orderable drug from [[CPRS~|CPRS]])
  
  
Line 96: Line 191:
 
  ANOTHER ONE:
 
  ANOTHER ONE:
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)
+
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and [[Record~|Record]] Number (IEN)
 
   
 
   
 
  NUMBER: 1                               
 
  NUMBER: 1                               
Line 118: Line 213:
 
  ANOTHER ONE:
 
  ANOTHER ONE:
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)
+
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and [[Record~|Record]] Number (IEN)
 
   
 
   
 
  NUMBER: 774                             
 
  NUMBER: 774                             
Line 162: Line 257:
 
  ANOTHER ONE:
 
  ANOTHER ONE:
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
 
  STANDARD CAPTIONED OUTPUT? Yes//  (Yes)
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)
+
  Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and [[Record~|Record]] Number (IEN)
 
   
 
   
 
  NUMBER: 2                               
 
  NUMBER: 2                               
Line 175: Line 270:
  
  
=== Steps to Adding One Drug / Making Available in CPRS ===
+
=== Steps to Adding One Drug / Making Available in [[CPRS~|CPRS]] ===
  
 
  GTM>set PSEDITNM=1
 
  GTM>set PSEDITNM=1
Line 258: Line 353:
 
Here is a pharmacy option/menu setup I gathered:
 
Here is a pharmacy option/menu setup I gathered:
  
 +
  ADD    Drug Enter/Edit [PSS DRUG ENTER/EDIT]
 
   cv    Protocol Conversion Utilities ... [ORCM CONVERSION UTILITIES]
 
   cv    Protocol Conversion Utilities ... [ORCM CONVERSION UTILITIES]
 +
  EOI    Edit Orderable Items [PSS EDIT ORDERABLE ITEMS]
 
   Mgr    Pharmacy Data Management ... [PSS MGR]
 
   Mgr    Pharmacy Data Management ... [PSS MGR]
 
   NDF    National Drug File Menu ... [PSNMGR]
 
   NDF    National Drug File Menu ... [PSNMGR]
 
   Out    Outpatient Pharmacy Manager ... [PSO MANAGER]
 
   Out    Outpatient Pharmacy Manager ... [PSO MANAGER]
 +
  xxx    Enter/Edit a Drug [PSA DRUG ENTER/EDIT]  <--- don't use this one
 
           Drug Accountability Menu ... [PSA DRUG ACCOUNTABILITY MENU]
 
           Drug Accountability Menu ... [PSA DRUG ACCOUNTABILITY MENU]
 
           Drug Receipt History Review [PSA DRUG HISTORY]
 
           Drug Receipt History Review [PSA DRUG HISTORY]
 
           Drug Transaction History [PSA DRUG DISPLAY]
 
           Drug Transaction History [PSA DRUG DISPLAY]
          Enter/Edit a Drug [PSA DRUG ENTER/EDIT]
 
 
           Inquire/Compare DRUG file/ITEM MASTER file [PSA DRUG INQUIRE]
 
           Inquire/Compare DRUG file/ITEM MASTER file [PSA DRUG INQUIRE]
  
 
----
 
----
  
 +
=== Emails Regarding Adding Drugs ===
 +
Moved here: [[Pharmacy Setup Emails]]
 +
 +
=== Instructions for entering a drug through menus ===
 +
Helpful post here:  [[Instructions for New Drug Entry]]
 +
 +
=== RPC Calls ===
 +
ORWUL^FVSUB -- gets the list of drugs to display in the box.
 +
 +
ORWDXA ISACTOI
 +
 +
ORWDPS1 FAILDEA
 +
 +
ORWOR PKISITE
 +
 +
 +
When a drug is selected in the new medicine dialog, the following RPC's are called:
 +
 +
ORWDPS2 OISLCT
 +
example params:  1158,0,1,Y,N
 +
 +
Remote procedure file details for this:
 +
OISLCT^ORWDPS2(LST,OI,PSTYPE,ORVP,NEEDPI,PKIACTIV)
 +
 +
This returns defaults for ordering
 +
 +
Example:
 +
Params ------------------------------------------------------------------
 +
literal 1158
 +
literal O
 +
literal 1
 +
literal Y
 +
literal N
 +
 
 +
Results -----------------------------------------------------------------
 +
~Medication
 +
d1158^ACYCLOVIR CAP,ORAL
 +
~Verb
 +
dTAKE
 +
~Preposition
 +
dBY
 +
~PtInstr
 +
~AllDoses
 +
i200MG^5671^200&MG&1&CAPSULE&200MG&5671&200&MG
 +
i400MG^5671^400&MG&2&CAPSULES&400MG&5671&200&MG
 +
  NOTE: format-- iDrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Stren^
 +
                DoseText^CostText^MaxRefills^DispUnits^CanSplit
 +
~Dosage
 +
iACYCLOVIR 200MG^200MG^^200&MG&1&CAPSULE&200MG&5671&200&MG^200MG^^11^CAP
 +
iACYCLOVIR 200MG^200MG^^400&MG&2&CAPSULES&400MG&5671&200&MG^400MG^^11^CAP
 +
  NOTE: format-- iDrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Stren^
 +
                DoseText^CostText^MaxRefills^DispUnits^CanSplit
 +
~Dispense
 +
i5671^200^MG^ACYCLOVIR 200MG^0
 +
  NOTE: format-- DrugIEN^Strength^Units^Name^Splict
 +
~Route
 +
i1^ORAL^PO^MOUTH^0
 +
~Schedule
 +
~Guideline
 +
~Message
 +
~DEASchedule
 +
d
 +
 +
=== Completion of [[CPRS~|CPRS] drug orders ===
 +
The menu option for completing a medication order entered in [[CPRS~|CPRS]] is PSO LMOE FINISH
 +
 +
This menu option causes execution of code: DO ^PSOORFIN
 +
The  code for PSOORFIN.m in my VOE folder has a copyright GNU GPL WorldVista.  This is different from the one in my older server setup.
 +
 +
File 52.41 holds PENDING OUTPATIENT ORDERS
 +
And after the order is "finished" via the above order, it is removed from this file.
 +
 +
-------older stuff below------------
 +
 +
This is a debug trace.  First, I entered a drug in [[CPRS~|CPRS]], but didn't sign it....
 +
 +
[[CPRS~|CPRS]] gets name of drug order (unsigned) via
 +
 +
ORWORR GETTXT
 +
Params:  "239;1"
 +
Results:
 +
  PENICILLIN TAB 250MG
 +
  TAKE ONE TABLET BY MOUTH TWICE A DAY
 +
  Quantity: 20 Refills: 0 *UNSIGNED*
 +
 +
Above, 239;1 is the link to the drug order.  It comes from:
 +
 +
ORWORR AGET
 +
Params:  "70774", "2^0", "1", "0", "0", ""
 +
Results -----------------------------------------------------------------
 +
  10^2^
 +
  239;1^4^3080202.1616^^    <----- the drug order
 +
  229;1^43^3080201.1208^^
 +
  ...
 +
 +
I then signed the order in [[CPRS~|CPRS]].  It is now displayed on the medications tab.  Here is the RPC that got that:
 +
 +
ORWPS ACTIVE
 +
Params "70774"
 +
Results
 +
  ~OP^44P;O^PENICILLIN TAB 250 MG^^^^^^239^PENDING^^^20^^0
 +
  PENICILLIN TAB 250 MG  Qty: 20
 +
  \ Sig: TAKE ONE TABLET BY MOUTH TWICE A DAY
 +
 +
 +
After a drug is entered in [[CPRS~|CPRS]], it is put into:
 +
  file 52.41 - PENDING OUTPATIENT ORDERS
  
 +
-------------------
 +
Now, to complete the prescription, must go to Terminal mode.
  
=== Emails Regarding Adding Drugs ===
+
menu options:
Moved here: [[Pharmacy Setup Emails]]
+
  PSO MANAGER --> PSO RX --> PSO LM BACKDOOR ORDERS
 +
 
 +
From there I am taken into a screenman form where I can view and
 +
update the patient information.  I press ENTER twice, and then I am
 +
shown the prescription that is pending (i.e. signed in [[CPRS~|CPRS]]).
 +
 
 +
I am able to edit the prescription.  And then I enter FN to finish the
 +
prescription.
 +
 
 +
From there I am prompted:
 +
Select New Rx # for TEST,KEVIN: ??
 +
 +
    ENTER A VALID PRESCRIPTION NUMBER
 +
    OR BARCODE PRESCRIPTION NUMBER
 +
    OR 'P' TO GET A PATIENT PROFILE
 +
          (works only if in the OUTPATIENT package)
 +
 +
This is the prescription number.
 +
 +
Select New Rx # for TEST,KEVIN:
 +
 +
''Initially I had a problem, but then got this working, after fixing a bug in my version of the PSO code.  I kept getting a crash at ACP+6^PSOORNEW when I would enter a prescription number.  I stepped through it and found that PSONEW("QFLG") was not being set, which then caused a "variable-doesn't-exist" error.  I wrapped this in a $G() and the code was able to continue and complete the prescription. ...  Another problem was that I didn't have the setting correct regarding automatically numbering prescriptions.  I needed to set that to "YES", and then give an upper and lower range and a last-prescribed value into a fields 27000...''
 +
 
 +
Tracing through the code, I find the following stack (order of execution) (earliest calls on the bottom) when I break at the first [[prompt~|Prompt]] after launching a FN finish.
 +
 
 +
  EN^PSON52        <-- create new entry in prescription file
 +
  ACP+10^PSOORNEW  <-- Module: display orders from oerr
 +
  LOOP+6^XQOR1    <-- [[Kernel Unwinder]] code
 +
  STAK+3^XQOR1    <-- [[Kernel Unwinder]] code
 +
  ASK+1^VALM      <-- [[ListMan]] code
 +
  EN+8^VALM        <-- [[ListMan]] code
 +
  EN+1^PSOLMPO    <-- starts [[ListMan]] session to allow FN to be chosen
 +
  PST+42^PSOORFI1  <-- shows order
 +
  ORD+14^PSOORFIN  <-- Module: finish [[cprs~|CPRS]] orders
 +
  OK^PSOORNE5
 +
  NEWSEL+2^PSOORNE2
 +
  NEWSEL+1^PSOORNE2
 +
  NEWSEL+1^PSOLMUTL
 +
  ...
 +
 
 +
My goal was to see if I could create an API out of this process, so that the launching of completion of the FN could be done programatically.
 +
 
 +
I did find that EN^PSON52(PSOX) seems to be a key entry point.  It is called from ACP^PSOORNEW
 +
 
 +
Starting in ACP^PSOORNEW, I found that PSONEW is modified.  Then it is passed as PSOX into EN^PSON52.  So the question is, what is setup prior to this call?
 +
 
 +
PSODRUG seems to contain the info for the drug that has been prescribed.
 +
 
 +
  PSODRUG("CLN")=269
 +
  PSODRUG("COST")=""
 +
  PSODRUG("DEA")=""
 +
  PSODRUG("EXPIRATION DATE")=""
 +
  PSODRUG("OIN")="A-HYDROCORT INJ"
 +
  PSODRUG("SIG")="USE AS DIRECTED"
 +
  PSODRUG("UNIT")=""
 +
  PSODRUG("VA CLASS")="HS051"
 +
 
 +
PSONEW contains other info
 +
 
 +
  PSONEW("# OF REFILLS")=0
 +
  PSONEW("CHCS NUMBER")=""
 +
  PSONEW("CLERK CODE")=73
 +
  PSONEW("CLINIC")=6
 +
  PSONEW("DAYS SUPPLY")=30
 +
  PSONEW("DFLG")=0
 +
  PSONEW("DOSE",1)="54;14"
 +
  PSONEW("DOSE ORDERED",1)=1
 +
  PSONEW("DURATION",1)=""
 +
  PSONEW("ENT")=1
 +
  PSONEW("EXTERNAL SYSTEM")=""
 +
  PSONEW("FILL DATE")=3090404
 +
  PSONEW("ISSUE DATE")="APR 4,2009"
 +
  PSONEW("MAIL/WINDOW")="W"
 +
  PSONEW("NOUN",1)=""
 +
  PSONEW("PATIENT STATUS")=20
 +
  PSONEW("PROVIDER")=73
 +
  PSONEW("PROVIDER NAME")="TOPPENBERG,KEVIN S"
 +
  PSONEW("QFLG")=0
 +
  PSONEW("QTY")=60
 +
  PSONEW("REMARKS")=""
 +
  PSONEW("ROUTE",1)=1
 +
  PSONEW("SCHEDULE",1)="BID"
 +
  PSONEW("UNITS",1)=1391
 +
  PSONEW("VERB",1)="TAKE"
 +
 
 +
By the end of ACP, PSONEW has had the following fields added:
 +
 
 +
PSONEW("NEWCOPAY")=0
 +
PSONEW("OLD LAST RX#",8)=22
 +
PSONEW("POE")=1
 +
PSONEW("RX #")=23
 +
 
 +
After passed as PSORX into EN^PSON52, the values are as below.  Notice that drug name is still missing, so I think that PSODRUG is also still required.
 +
 
 +
  PSOX("# OF REFILLS")=0
 +
  PSOX("CHCS NUMBER")=""
 +
  PSOX("CLERK CODE")=73
 +
  PSOX("CLINIC")=6
 +
  PSOX("DAYS SUPPLY")=30
 +
  PSOX("DFLG")=0
 +
  PSOX("DOSE",1)="5;30;100"
 +
  PSOX("DOSE ORDERED",1)=1
 +
  PSOX("DURATION",1)=""
 +
  PSOX("ENT")=1
 +
  PSOX("EXTERNAL SYSTEM")=""
 +
  PSOX("FILL DATE")=3090403
 +
  PSOX("ISSUE DATE")="APR 3,2009"
 +
  PSOX("MAIL/WINDOW")="W"
 +
  PSOX("NEWCOPAY")=0
 +
  PSOX("NOUN",1)=""
 +
  PSOX("OLD LAST RX#",8)=22
 +
  PSOX("PATIENT STATUS")=20
 +
  PSOX("POE")=1
 +
  PSOX("PROVIDER")=73
 +
  PSOX("PROVIDER NAME")="TOPPENBERG,KEVIN S"
 +
  PSOX("QFLG")=0
 +
  PSOX("QTY")=5
 +
  PSOX("REMARKS")=""
 +
  PSOX("ROUTE",1)=1
 +
  PSOX("RX #")=23
 +
  PSOX("SCHEDULE",1)="NOW"
 +
  PSOX("UNITS",1)=967
 +
  PSOX("VERB",1)="TAKE"
 +
 
 +
After creating the new entry, the pending entry is deleted here
 +
  DCORD+1^PSONEW2
 +
 
 +
So the next question is, how can I populate PSONEW given an IEN in the pending orders file?
 +
 
 +
 
 +
-------------------
 +
After the drug is completed in the Terminal, it is removed from File 52.41 holds PENDING OUTPATIENT ORDERS.
 +
 
 +
However, from [[CPRS~|CPRS]], it is still the same RPC call [ORWPS ACTIVE] that gets the list of active medications--both those Pending (await terminal-mode completion, meaning that they are in the PENDING OUTPATIENT ORDERS) and those that are completed.
 +
 
 +
=== Prescription Auto-Finishing ===
 +
 
 +
This section got too long.  So moved to a separate page.
 +
 
 +
[[Prescription Auto-Finishing]]

Latest revision as of 16:25, 20 February 2013

This page will contain notes to work out pharmacy programming issues.

Initiated by K. Toppenberg 4/2005

Keys Needed for Pharm. Setup

We searched pharmacy routines and found keys that were needed for some of the pharmacy setup routines. Here are the keys that were found: PSA ORDERS, PSAMGR, PSJ RPWARN, PSB MANAGER, PSB CPRS MED BUTTON, PSB INSTRUCTOR, PROVIDER, PSD TECH, PSDMGR, PSD BUMGR, PSD ERROR, PSD PARAM, PSD TRAN


Files and Relationships

  • VA PRODUCT file (file #50.68, ^PSNDF(50.68,*)) holds ALL possible drugs. Some people refer to this as the National Drug File. FILE 50.68
  • VA GENERIC file (file #50.6, ^PSNDF(50.6))
  • DRUG file (file #50, ^PSDRUG(*)) holds all the drugs in the local formulary. This links to above. FILE 50
  • PHARMACY ORDERABLE ITEM file (file #50.7, ^PS(50.7,*)) holds things that can be ordered from the pharmacy. This links to above. FILE 50.7
  • ORDERABLE ITEM file (file #101.43, ^ORD(101.43,*)) holds things that can be ordered, including labs and drugs. This links to above. FILE 101.43
  • ORDER QUICK VIEW file (file #101.44, ^ORD(101.44,*)) holds "quick order" entries. This links to above. FILE 101.44
  • PENDING OUTPATIENT ORDERS file (file #52.41, ^PS(52.41,*)) holds prescription requests entries, to be approved by pharmacist FILE 52.41
  • PRESCRIPTION FILE file (file #52, ^PSRX(*)) holds prescriptions FILE 52

Summary of Pharmacy File Linkages

What I Have Learned so Far

1. File 50.7 (PHARMACY ORDERABLE ITEM):

 **A Record in this file should be created first.  
 .01 field should be the generic name of the drug.
 When the Record is created, an entry in fle 101.43 (ORDERABLE ITEM) will automatically be made.
 Also, a Record in in ORDER QUICK VIEW will also be created (but it is incomplete--see below.)
 Note: new drugs may not be added unless PSEDITNM>0.  So to setup a drug in fileman,
       set PSEDITNM=1 from the command-line, then DO D^DI to get into Fileman with vars intact.
 In the MED ROUTE field, the input transform does not allow an input of "ORAL".  (If left
 blank ORAL will be shown in CPRS)
 This file can hold the synonyms of a drug etc.
 When this Record is created, for some reason it is automatically given the current
   date in the INACTIVE DATE field--meaning it is created in an inactive state.  One must
   go back and edit the Record a second time to remove the entry from this field.
 File 101.43 (ORDERABLE ITEM), field ID holds a text pointer to this file, e.g. 
 "10;99PSP" <---- 10 is IEN in file #50.7
 There is no pointer field from file 50.7 up to file 50.  The link is FROM file #50 
 TO #50.7 (via file #50's field 2.1(PHARMACY ORDERABLE ITEM)).  HOWEVER, File #50's 
 "ASP" cross-reference for the field "PHARMACY ORDERABLE ITEM (#2.1) i.e. 
 ^PSDRUG("ASP",IEN_in_50.7,*), contains list of linked Records in file #50


2. In file# 50 (DRUG, ^PSDRUG):

 This file will hold a separate Record for every different medication/tablet size.
 For example, there will be one for AMOXICILLIN 250, and another for AMOXICILLIN 500.
 Both of the above Records would be linked to one Record in the PHARMACY ORDERABLE ITEM,
 i.e. an AMOXICILLIN Record.
 The link should be in field 2.1 (the PHARMACY ORDERABLE ITEM field), which will
   hold a pointer to file 50.7 (PHARMACY ORDERABLE ITEM file)
 

3. In file 101.43 (ORDERABLE ITEM) an entry for the drug must exist like this:

  This entry should have been made automatically when the PHARMACY ORDERABLE ITEM was
  created.
 
 file 101.43
 Record: .01 NAME = LISINOPRIL
           2 ID = "Unique identifier, created from primary key passed in the 
                  Orderable Items update message from each package; it will be 
                  in the form of 'package code;99XXX' where XXX indicates the 
                  package table originating this item (i.e. RAP,LRT,etc.)
                  [e.g. in my system, then entry for DILTIAZEM TAB is 1;99PSP]
                  "Package code" should be the IEN on the PHARMACY ORDERABLE ITEM (#50.7)

4. 101.44 (ORDER QUICK VIEW) For meds to show up in the dialog box in CPRS, it must have a entry like this:

 Again, this entry should have been created automatically when the PHARMACY ORDERABLE ITEM
 was created.  But for some reason, the DISPLAY TEXT field is not filled in.  Without this,
 the drug will not appear in CPRS.  So this must be manually supplied.
file: 101.44 (ORDER QUICK VIEW);  
 Record: ORWDSET O RX;  
   subfile: SET MEMBER (101.442)
     Record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)   ... a drug would go here
             DISPLAY TEXT: "A name to appear in CPRS appears here.
     Record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)   ... a drug would go here
             DISPLAY TEXT: "A name to appear in CPRS appears here.
     Record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)   ... a drug would go here
             DISPLAY TEXT: "A name to appear in CPRS appears here.
     Record: SET MEMBER: _IEN_ pointer to 101.43 (ORDERABLE ITEM)   ... a drug would go here
             DISPLAY TEXT: "A name to appear in CPRS appears here.

Example of Data

File 101.44 (ORDER QUICK VIEW)
   .01-NAME : ORWDSET O RX
     6-LAST UPDATE : 60414,61441
    20-SET MEMBER :
       -snip-
       Multiple Entry #15  <--- notice that there are no doses
       .01-SET MEMBER : SILDENAFIL TAB  <-- pointer to 101.43
         2-DISPLAY TEXT : SILDENAFIL TAB
       -snip-
       Multiple Entry #17  <--- notice that there are no doses
       .01-SET MEMBER : SILDENAFIL TAB  <-- pointer to 101.43
         2-DISPLAY TEXT : VIAGRA     <SILDENAFIL TAB>
       -snip-
  ||
  ||
  \/

File 101.43 (ORDERABLE ITEM)
   .01-NAME : SILDENAFIL TAB
     1-SYNONYMS :
       Multiple Entry #1
       .01-SYNONYM : VIAGRA
   1.1-PACKAGE NAME : SILDENAFIL TAB
     2-ID : 4;99PSP   <--- pointer to IEN=4 in 50.7
     5-DISPLAY GROUP : PHARMACY
     9-SET MEMBERSHIP :
       Multiple Entry #1
       .01-SET : RX
   -snip-
  ||
  ||
  \/

File 50.7 (PHARMACY ORDERABLE ITEM)
   .01-NAME : SILDENAFIL
   .02-DOSAGE FORM : TAB
   .05-DAY (nD) or DOSE (nL) LIMIT : 2L
   .07-SCHEDULE TYPE : FILL ON REQUEST
     2-SYNONYM :
       Multiple Entry #1
       .01-SYNONYM : VIAGRA  <-- free text
     7-PATIENT INSTRUCTIONS : [Do not take with nitroglycerin]
  ||
  ||
  \/

ASP index in file 50 allows link from 50.7 --> 50
 ^PSDRUG("ASP",4,7118) =   IEN# 4 in 50.7 --> IEN# 7118 in 50
  ||
  ||
  \/

File 50 (DRUG file)  (some noncontributory fields edited)
  .001-NUMBER : 7118
   .01-GENERIC NAME : SILDENAFIL (Viagra) 50MG TAB
   2.1-PHARMACY ORDERABLE ITEM : SILDENAFIL
     9-SYNONYM :
       Multiple Entry #2
       .01-SYNONYM : VIAGRA
         1-INTENDED USE : TRADE NAME
  14.5-DISPENSE UNIT : TAB
    20-NATIONAL DRUG FILE ENTRY : SILDENAFIL
    21-VA PRODUCT NAME : SILDENAFIL CITRATE 50MG TAB
    22-PSNDF VA PRODUCT NAME ENTRY : SILDENAFIL CITRATE 50MG TAB
   101-MESSAGE : Use for 25mg dose only
   215-QUANTITY DISPENSE MESSAGE : MAX 4 DOSE/MO-CONTRAINDICATED WITH NITRATES
   901-STRENGTH : 50
   902-UNIT : MG
   903-POSSIBLE DOSAGES :
       Multiple Entry #1
       .01-DISPENSE UNITS PER DOSE : 1
         2-PACKAGE : IO
       Multiple Entry #2
       .01-DISPENSE UNITS PER DOSE : .5
         2-PACKAGE : O
       Multiple Entry #3
       .01-DISPENSE UNITS PER DOSE : 1
         1-DOSE : 50
         2-PACKAGE : IO
       Multiple Entry #4
       .01-DISPENSE UNITS PER DOSE : 2
         1-DOSE : 100
         2-PACKAGE : IO



Example Entry

Here is an example of entering the drug the "proper" way, via menu options: Drug Entry Edit Example

Here is a sample inquirery of one successfuly added drug: furosemide (NOTICE: in this system, there is only 1 orderable drug from CPRS)


OUTPUT FROM WHAT FILE: NEW PERSON// 50.7  PHARMACY ORDERABLE ITEM
                                          (1 entry)
(NOTE: reformatted for easier reading)
Select PHARMACY ORDERABLE ITEM NAME: ?
    Answer with PHARMACY ORDERABLE ITEM NAME, or SYNONYM, or OI-DRUG TEXT ENTRY:
   FUROSEMIDE      FUROSEMIDE     TAB

Select PHARMACY ORDERABLE ITEM NAME: furOSEMIDE       TAB
ANOTHER ONE:
STANDARD CAPTIONED OUTPUT? Yes//   (Yes)
Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)

NUMBER: 1                               
  NAME: FUROSEMIDE
  SYNONYM: LASIX
  DOSAGE FORM: TAB

Select PHARMACY ORDERABLE ITEM NAME:


OUTPUT FROM WHAT FILE: 101.43  ORDERABLE ITEMS//
(NOTE: reformatted for easier reading)
Select ORDERABLE ITEMS NAME: furose
     1   FUROSEMIDE
     2   FUROSEMIDE TAB
CHOOSE 1-2: 1  FUROSEMIDE
ANOTHER ONE: furo
     1   FUROSEMIDE
     2   FUROSEMIDE TAB
CHOOSE 1-2: 2  FUROSEMIDE TAB
ANOTHER ONE:
STANDARD CAPTIONED OUTPUT? Yes//   (Yes)
Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)

NUMBER: 774                             
  NAME: FUROSEMIDE
  ID: 828;99LRT                         
  DISPLAY GROUP: LABORATORY
  PACKAGE NAME: FUROSEMIDE
  SYNONYM: LASIX
  SET: LAB
  TYPE: both


NUMBER: 1659                            
  NAME: FUROSEMIDE TAB
  ID: 1;99PSP  <---- x;99PSP  x=IEN in file# 50.7 (PHARMACY ORDERABLE ITEM)
  DISPLAY GROUP: PHARMACY
  PACKAGE NAME: FUROSEMIDE TAB
  SET: RX
  SET: UD RX
  SET: O RX
    INPATIENT MED: YES                    
    OUTPATIENT MED: YES
    IV BASE: NO                           
    IV ADDITIVE: NO
    SUPPLY: NO                            
    NON-FORMULARY: NO
    NON-VA MEDS: NO


Select ORDERABLE ITEMS NAME:


OUTPUT FROM WHAT FILE: 101.44  ORDER QUICK VIEW
                                          (2 entries)
(NOTE: reformatted for easier reading)
Select ORDER QUICK VIEW NAME: ?
    Answer with ORDER QUICK VIEW NAME
   Choose from:
   ORWDQ PKG35 DO
   ORWDSET O RX

Select ORDER QUICK VIEW NAME: orwdset O RX
ANOTHER ONE:
STANDARD CAPTIONED OUTPUT? Yes//   (Yes)
Include COMPUTED fields:  (N/Y/R/B): NO// b  BOTH Computed Fields and Record Number (IEN)

NUMBER: 2                               
  NAME: ORWDSET O RX
  LAST UPDATE: 60201,74282
  SET MEMBER: FUROSEMIDE TAB              
    DISPLAY TEXT: FUROSEMIDE TAB

Select ORDER QUICK VIEW NAME:

Other Important Pharmacy Files and Relationships

Steps to Adding One Drug / Making Available in CPRS

GTM>set PSEDITNM=1
GTM>D D^DI

VA FileMan 22.0
Select OPTION: enter OR EDIT FILE ENTRIES

INPUT TO WHAT FILE: DRUG// 50.7  PHARMACY ORDERABLE ITEM
                                          (3 entries)
EDIT WHICH FIELD: ALL//

Select PHARMACY ORDERABLE ITEM NAME: VIAGRA
 Are you adding 'VIAGRA' as a new PHARMACY ORDERABLE ITEM (the 4TH)? No// Y
 (Yes)
  PHARMACY ORDERABLE ITEM DOSAGE FORM: tab
    1   TAB
    2   TAB,BUCC,SA
    3   TAB,BUCCAL
    4   TAB,CHEWABLE
    5   TAB,CHEWG GUM
Press <RETURN> to see more, '^' to exit this list, OR
CHOOSE 1-5: 1  TAB
  PHARMACY ORDERABLE ITEM INACTIVE DATE:
DOSAGE FORM: TAB//   (No Editing)
IV FLAG:
INACTIVE DATE:
DAY (nD) or DOSE (nL) LIMIT: ??
    Type a whole number between 0 and 99, 0 decimal digits, followed by either
    a "D" (for NUMBER OF DAYS) or an "L" (for DOSE LIMIT).
DAY (nD) or DOSE (nL) LIMIT: 2L
MED ROUTE:
SCHEDULE TYPE: r  FILL ON REQUEST
SCHEDULE:
SUPPLY:
Select SYNONYM: VIAGRA
 Are you adding 'VIAGRA' as a new SYNONYM (the 1ST for this PHARMACY ORDERABLE ITEM)? No// Y  (Yes)
Select SYNONYM:
Select OI-DRUG TEXT ENTRY:
PATIENT INSTRUCTIONS: [Do not take with nitroglycerin]

[Do not take with nitroglycerin]
OTHER LANGUAGE INSTRUCTIONS:
NON-VA MED:

Select PHARMACY ORDERABLE ITEM NAME:

Select OPTION:

Note: You have to go back and edit the INACTIVE DATE, and delete the value.



Now create link from #50, field 2.1 --> 50.7


Select OPTION: eNTER OR EDIT FILE ENTRIES

INPUT TO WHAT FILE: DRUG// 50  DRUG       (5173 entries)
EDIT WHICH FIELD: ALL// pharmACY ORDERABLE ITEM
THEN EDIT FIELD:

Select DRUG GENERIC NAME: viagra
1  VIAGRA  SILDENAFIL (Viagra) 50MG TAB   GU900  Use for 25mg dose only
2  VIAGRA  SILDENAFIL (Viagra) 100MG TAB  GU900  ONLY 4 DOSES PER MONTH ALLOWED
CHOOSE 1-2: 1  SILDENAFIL (Viagra) 50MG TAB  GU900  Use for 25mg dose only
PHARMACY ORDERABLE ITEM: viagra  TAB  04-25-2005 <--- Date is an INACTIVE data. Delete value in 50.7 

Select DRUG GENERIC NAME: viag
1  VIAGRA  SILDENAFIL (Viagra) 50MG TAB   GU900  Use for 25mg dose only
2  VIAGRA  SILDENAFIL (Viagra) 100MG TAB  GU900  ONLY 4 DOSES PER MONTH ALLOWED
CHOOSE 1-2: 2  SILDENAFIL (Viagra) 100MG TAB  GU900 ONLY 4 DOSES PER MONTH ALLOWED
PHARMACY ORDERABLE ITEM: viagra   TAB  04-25-2005 <--- Date is an INACTIVE data. Delete value in 50.7

Select DRUG GENERIC NAME:

Select OPTION:

... to be continued later.....

Relevent Menu Options

Here is a pharmacy option/menu setup I gathered:

  ADD    Drug Enter/Edit [PSS DRUG ENTER/EDIT]
  cv     Protocol Conversion Utilities ... [ORCM CONVERSION UTILITIES]
  EOI    Edit Orderable Items [PSS EDIT ORDERABLE ITEMS]
  Mgr    Pharmacy Data Management ... [PSS MGR]
  NDF    National Drug File Menu ... [PSNMGR]
  Out    Outpatient Pharmacy Manager ... [PSO MANAGER]
  xxx    Enter/Edit a Drug [PSA DRUG ENTER/EDIT]  <--- don't use this one
         Drug Accountability Menu ... [PSA DRUG ACCOUNTABILITY MENU]
         Drug Receipt History Review [PSA DRUG HISTORY]
         Drug Transaction History [PSA DRUG DISPLAY]
         Inquire/Compare DRUG file/ITEM MASTER file [PSA DRUG INQUIRE]

Emails Regarding Adding Drugs

Moved here: Pharmacy Setup Emails

Instructions for entering a drug through menus

Helpful post here: Instructions for New Drug Entry

RPC Calls

ORWUL^FVSUB -- gets the list of drugs to display in the box.

ORWDXA ISACTOI

ORWDPS1 FAILDEA

ORWOR PKISITE


When a drug is selected in the new medicine dialog, the following RPC's are called:

ORWDPS2 OISLCT
example params:  1158,0,1,Y,N
Remote procedure file details for this:
OISLCT^ORWDPS2(LST,OI,PSTYPE,ORVP,NEEDPI,PKIACTIV)

This returns defaults for ordering

Example:
Params ------------------------------------------------------------------
literal	1158
literal	O
literal	1
literal	Y
literal	N
 
Results -----------------------------------------------------------------
~Medication
d1158^ACYCLOVIR CAP,ORAL 
~Verb
dTAKE
~Preposition
dBY
~PtInstr
~AllDoses
i200MG^5671^200&MG&1&CAPSULE&200MG&5671&200&MG
i400MG^5671^400&MG&2&CAPSULES&400MG&5671&200&MG
 NOTE: format-- iDrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Stren^
                DoseText^CostText^MaxRefills^DispUnits^CanSplit
~Dosage
iACYCLOVIR 200MG^200MG^^200&MG&1&CAPSULE&200MG&5671&200&MG^200MG^^11^CAP
iACYCLOVIR 200MG^200MG^^400&MG&2&CAPSULES&400MG&5671&200&MG^400MG^^11^CAP
 NOTE: format-- iDrugName^Strength^NF^TDose&Units&U/D&Noun&LDose&Stren^
                DoseText^CostText^MaxRefills^DispUnits^CanSplit
~Dispense
i5671^200^MG^ACYCLOVIR 200MG^0
 NOTE: format-- DrugIEN^Strength^Units^Name^Splict
~Route
i1^ORAL^PO^MOUTH^0
~Schedule
~Guideline
~Message
~DEASchedule
d

Completion of [[CPRS~|CPRS] drug orders

The menu option for completing a medication order entered in CPRS is PSO LMOE FINISH

This menu option causes execution of code: DO ^PSOORFIN The code for PSOORFIN.m in my VOE folder has a copyright GNU GPL WorldVista. This is different from the one in my older server setup.

File 52.41 holds PENDING OUTPATIENT ORDERS And after the order is "finished" via the above order, it is removed from this file.


older stuff below------------

This is a debug trace. First, I entered a drug in CPRS, but didn't sign it....

CPRS gets name of drug order (unsigned) via

ORWORR GETTXT
Params:  "239;1"
Results:
 PENICILLIN TAB 250MG
 TAKE ONE TABLET BY MOUTH TWICE A DAY
 Quantity: 20 Refills: 0 *UNSIGNED*

Above, 239;1 is the link to the drug order.  It comes from: 

ORWORR AGET
Params:   "70774", "2^0", "1", "0", "0", ""
Results -----------------------------------------------------------------
 10^2^
 239;1^4^3080202.1616^^    <----- the drug order
 229;1^43^3080201.1208^^
 ...

I then signed the order in CPRS.  It is now displayed on the medications tab.  Here is the RPC that got that:
ORWPS ACTIVE
Params "70774"
Results 
 ~OP^44P;O^PENICILLIN TAB 250 MG^^^^^^239^PENDING^^^20^^0
  PENICILLIN TAB 250 MG  Qty: 20
 \ Sig: TAKE ONE TABLET BY MOUTH TWICE A DAY


After a drug is entered in CPRS, it is put into:
 file 52.41 - PENDING OUTPATIENT ORDERS

Now, to complete the prescription, must go to Terminal mode.

menu options:

 PSO MANAGER --> PSO RX --> PSO LM BACKDOOR ORDERS

From there I am taken into a screenman form where I can view and update the patient information. I press ENTER twice, and then I am shown the prescription that is pending (i.e. signed in CPRS).

I am able to edit the prescription. And then I enter FN to finish the prescription.

From there I am prompted:
Select New Rx # for TEST,KEVIN: ??

    ENTER A VALID PRESCRIPTION NUMBER
    OR BARCODE PRESCRIPTION NUMBER
    OR 'P' TO GET A PATIENT PROFILE
         (works only if in the OUTPATIENT package)

This is the prescription number.

Select New Rx # for TEST,KEVIN:

Initially I had a problem, but then got this working, after fixing a bug in my version of the PSO code. I kept getting a crash at ACP+6^PSOORNEW when I would enter a prescription number. I stepped through it and found that PSONEW("QFLG") was not being set, which then caused a "variable-doesn't-exist" error. I wrapped this in a $G() and the code was able to continue and complete the prescription. ... Another problem was that I didn't have the setting correct regarding automatically numbering prescriptions. I needed to set that to "YES", and then give an upper and lower range and a last-prescribed value into a fields 27000...

Tracing through the code, I find the following stack (order of execution) (earliest calls on the bottom) when I break at the first Prompt after launching a FN finish.

 EN^PSON52        <-- create new entry in prescription file
 ACP+10^PSOORNEW  <-- Module: display orders from oerr 
 LOOP+6^XQOR1     <-- Kernel Unwinder code
 STAK+3^XQOR1     <-- Kernel Unwinder code
 ASK+1^VALM       <-- ListMan code
 EN+8^VALM        <-- ListMan code
 EN+1^PSOLMPO     <-- starts ListMan session to allow FN to be chosen
 PST+42^PSOORFI1  <-- shows order 
 ORD+14^PSOORFIN  <-- Module: finish CPRS orders
 OK^PSOORNE5
 NEWSEL+2^PSOORNE2
 NEWSEL+1^PSOORNE2
 NEWSEL+1^PSOLMUTL
 ...

My goal was to see if I could create an API out of this process, so that the launching of completion of the FN could be done programatically.

I did find that EN^PSON52(PSOX) seems to be a key entry point. It is called from ACP^PSOORNEW

Starting in ACP^PSOORNEW, I found that PSONEW is modified. Then it is passed as PSOX into EN^PSON52. So the question is, what is setup prior to this call?

PSODRUG seems to contain the info for the drug that has been prescribed.

 PSODRUG("CLN")=269
 PSODRUG("COST")=""
 PSODRUG("DEA")=""
 PSODRUG("EXPIRATION DATE")=""
 PSODRUG("OIN")="A-HYDROCORT INJ"
 PSODRUG("SIG")="USE AS DIRECTED"
 PSODRUG("UNIT")=""
 PSODRUG("VA CLASS")="HS051"

PSONEW contains other info

 PSONEW("# OF REFILLS")=0
 PSONEW("CHCS NUMBER")=""
 PSONEW("CLERK CODE")=73
 PSONEW("CLINIC")=6
 PSONEW("DAYS SUPPLY")=30
 PSONEW("DFLG")=0
 PSONEW("DOSE",1)="54;14"
 PSONEW("DOSE ORDERED",1)=1
 PSONEW("DURATION",1)=""
 PSONEW("ENT")=1
 PSONEW("EXTERNAL SYSTEM")=""
 PSONEW("FILL DATE")=3090404
 PSONEW("ISSUE DATE")="APR 4,2009"
 PSONEW("MAIL/WINDOW")="W"
 PSONEW("NOUN",1)=""
 PSONEW("PATIENT STATUS")=20
 PSONEW("PROVIDER")=73
 PSONEW("PROVIDER NAME")="TOPPENBERG,KEVIN S"
 PSONEW("QFLG")=0
 PSONEW("QTY")=60
 PSONEW("REMARKS")=""
 PSONEW("ROUTE",1)=1
 PSONEW("SCHEDULE",1)="BID"
 PSONEW("UNITS",1)=1391
 PSONEW("VERB",1)="TAKE"

By the end of ACP, PSONEW has had the following fields added:

PSONEW("NEWCOPAY")=0
PSONEW("OLD LAST RX#",8)=22
PSONEW("POE")=1
PSONEW("RX #")=23

After passed as PSORX into EN^PSON52, the values are as below. Notice that drug name is still missing, so I think that PSODRUG is also still required.

 PSOX("# OF REFILLS")=0
 PSOX("CHCS NUMBER")=""
 PSOX("CLERK CODE")=73
 PSOX("CLINIC")=6
 PSOX("DAYS SUPPLY")=30
 PSOX("DFLG")=0
 PSOX("DOSE",1)="5;30;100"
 PSOX("DOSE ORDERED",1)=1
 PSOX("DURATION",1)=""
 PSOX("ENT")=1
 PSOX("EXTERNAL SYSTEM")=""
 PSOX("FILL DATE")=3090403
 PSOX("ISSUE DATE")="APR 3,2009"
 PSOX("MAIL/WINDOW")="W"
 PSOX("NEWCOPAY")=0
 PSOX("NOUN",1)=""
 PSOX("OLD LAST RX#",8)=22
 PSOX("PATIENT STATUS")=20
 PSOX("POE")=1
 PSOX("PROVIDER")=73
 PSOX("PROVIDER NAME")="TOPPENBERG,KEVIN S"
 PSOX("QFLG")=0
 PSOX("QTY")=5
 PSOX("REMARKS")=""
 PSOX("ROUTE",1)=1
 PSOX("RX #")=23
 PSOX("SCHEDULE",1)="NOW"
 PSOX("UNITS",1)=967
 PSOX("VERB",1)="TAKE"

After creating the new entry, the pending entry is deleted here

 DCORD+1^PSONEW2

So the next question is, how can I populate PSONEW given an IEN in the pending orders file?



After the drug is completed in the Terminal, it is removed from File 52.41 holds PENDING OUTPATIENT ORDERS.

However, from CPRS, it is still the same RPC call [ORWPS ACTIVE] that gets the list of active medications--both those Pending (await terminal-mode completion, meaning that they are in the PENDING OUTPATIENT ORDERS) and those that are completed.

Prescription Auto-Finishing

This section got too long. So moved to a separate page.

Prescription Auto-Finishing