| 1 | PSJMDIR ;BIR/MV-MED DUE WORKSHEET DIR CALLS ;25 AUG 94 / 11:08 AM
 | 
|---|
| 2 |  ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | MEDTYPE(PSGMARWD) ;*** Ask for Med choices
 | 
|---|
| 5 |  ;PSGMARWD will be defined if the user was selected by ward.
 | 
|---|
| 6 |  ;If PSJMPRN is defined, that mean this module is calling from the MDWS.
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 |  K DIR S DIR(0)="LAO^1:6^I X[1&($L(X)>1) K X" S DIR("A")="Enter medication type(s): "
 | 
|---|
| 9 |  S DIR("?",1)="1.  All medications",DIR("?",2)="2.  Non-IV medications only",DIR("?",3)="3.  IVPB (Includes IV syringe orders with a med route of IV or IVPB."
 | 
|---|
| 10 |  S DIR("?",4)="          All other IV syringe orders are included with non-IV medications).",DIR("?",5)="4.  LVPs",DIR("?",6)="5.  TPNs",DIR("?",7)="6.  Chemotherapy medications (IV)",DIR("?",8)=""
 | 
|---|
| 11 |  N XTYPE S:$G(PSGMARWD) XTYPE=$P($G(^PS(59.6,+$O(^PS(59.6,"B",+PSGMARWD,0)),0)),"^",2) S DIR("B")=$S($G(XTYPE):XTYPE,1:2)
 | 
|---|
| 12 |  S DIR("?")="e.g.  Enter 1 or 2-4,5 or 2."
 | 
|---|
| 13 |  S DIR("?",9)="A combination of choices can be entered here except for option 1."
 | 
|---|
| 14 |  W !! D ^DIR
 | 
|---|
| 15 |  Q $$STOP
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 | STDATE() ;*** Ask for starting date and time
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 |  K DIR S DIR(0)="DO^::EXAR",DIR("A")="Enter Start Date and Time",DIR("?")="Date and time must be entered." W !! D ^DIR
 | 
|---|
| 20 |  Q $$STOP
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 | ENDATE(PSGTMP,PSGTMP1) ;*** Ask for eding date and time
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  K DIR S DIR(0)="DAO^"_PSGTMP_":"_PSGTMP1_":EXAR",DIR("A")="Enter Ending Date and Time: "
 | 
|---|
| 25 |  S DIR("?")="Time must be entered.",DIR("?",1)="The worksheet will list only medications due for a 24 hour",DIR("?",2)="period.  Please keep ending date and time within that range."
 | 
|---|
| 26 |  W !! D ^DIR
 | 
|---|
| 27 |  Q $$STOP
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 | PRN() ;
 | 
|---|
| 30 |  ;
 | 
|---|
| 31 |  K DIR S DIR(0)="YO",DIR("A")="Would you like to include PRN Medications (Y/N)",DIR("B")="NO"
 | 
|---|
| 32 |  S DIR("?")="Answer ""YES"" to include PRN orders in the Medication Due Worksheet.  (The PRN medications will print after the Continuous medications.)"
 | 
|---|
| 33 |  W !! D ^DIR
 | 
|---|
| 34 |  Q $$STOP
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 | ADMTM ;*** Askif user want to sort by admin team
 | 
|---|
| 37 |  ;
 | 
|---|
| 38 |  S (PSGTM,PSGTMALL)=0
 | 
|---|
| 39 |  K DIR S DIR(0)="YO",DIR("A")="Do you want to sort by Administration Team (Y/N)",DIR("B")="NO"
 | 
|---|
| 40 |  S DIR("?",1)="Enter ""Y"" for ""YES"" if you wish to sort by Administration",DIR("?",2)="team. Enter ""N"" for ""NO"" if you do not wish to sort by",DIR("?",3)="Administration Team."
 | 
|---|
| 41 |  S DIR("?",4)="",DIR("?",5)="If you choose to sort by Adminstration Team, you",DIR("?")="may choose which teams will be included in the report."
 | 
|---|
| 42 |  W !! D ^DIR Q:$$STOP!'+Y
 | 
|---|
| 43 |  ;
 | 
|---|
| 44 |  ;*** Because "ALL" is not a team, must use DIR to include "ALL"
 | 
|---|
| 45 |  ;    default and then call DIC to look up the selected team
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 |  F  Q:$$STOP!(X="")!$G(PSGTMALL)  D ADMTM2
 | 
|---|
| 48 |  S PSGTM=$S($O(PSGTM(0))'="":1,1:0)
 | 
|---|
| 49 |  Q
 | 
|---|
| 50 | ADMTM2 ;
 | 
|---|
| 51 |  K DIR S DIR(0)="FAO",DIR("A")="Select Administration Team: ",DIR("B")="ALL",DIR("?")="^D DICTM^PSJMDIR" W ! D ^DIR Q:$$STOP  I Y="ALL" S PSGTMALL=1 Q
 | 
|---|
| 52 |  D DICTM
 | 
|---|
| 53 |  S PSJSTOP=$S($D(DTOUT):1,$D(DUOUT):1,(Y<0)&'$D(PFLG):1,1:0)
 | 
|---|
| 54 |  Q
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 | DICTM ;*** LooK up a team.
 | 
|---|
| 57 |  ;
 | 
|---|
| 58 |  K DIC S DIC="^PS(57.7,"_PSGWD_",1,",DIC(0)="QEMIZ"
 | 
|---|
| 59 |  F PFLG=0:1 D ^DIC Q:Y<0  I PFLG S DIC(0)=DIC(0)_"A",DIC("A")="Select another Administration Team: " S PSGTM(Y(0,0))=+Y
 | 
|---|
| 60 |  Q
 | 
|---|
| 61 |  ;
 | 
|---|
| 62 | RBADM ;*** Sort by PATIENT, ROOM-BED or ADMIN TIME
 | 
|---|
| 63 |  ;
 | 
|---|
| 64 |  K DIR S DIR(0)="SAO^A:Administration Time;R:Room-Bed;P:Patient",DIR("A")="Do you wish to sort by Administration Time (A), Room-Bed (R), Patient (P): ",DIR("B")="A"
 | 
|---|
| 65 |  S DIR("?",1)="Enter an ""A"" if you want orders to display in order of Administration Time.",DIR("?",2)="Enter a ""R"" if you want orders to display in order of patient room-bed."
 | 
|---|
| 66 |  S DIR("?")="Enter a ""P"" if you want orders to display in order of patient name."
 | 
|---|
| 67 |  W ! D ^DIR Q:$$STOP  S PSGRBADM=Y
 | 
|---|
| 68 |  Q
 | 
|---|
| 69 |  ;
 | 
|---|
| 70 | RBPPN ;*** Sort by ROOM-BED or PATIENT(when selected by WARD).
 | 
|---|
| 71 |  ;
 | 
|---|
| 72 |  K DIR S DIR(0)="SAO^R:Room-Bed;P:PATIENT",DIR("A")="Do you wish to sort by Room-Bed (R), Patient (P): ",DIR("B")="R"
 | 
|---|
| 73 |  S DIR("?",1)="Enter an ""R"" if you want orders to display in order of patient room-bed.",DIR("?")="Enter a ""P"" if you want orders to display in order of patient name."
 | 
|---|
| 74 |  W ! D ^DIR Q:$$STOP  S PSGRBPPN=Y
 | 
|---|
| 75 |  Q
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 | STOP() ;
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 |  S PSJSTOP=$S($D(DTOUT):1,$D(DUOUT):1,$D(DIRUT):1,1:0)
 | 
|---|
| 80 |  Q PSJSTOP
 | 
|---|