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

PSSDDUT.m

Go to the documentation of this file.
  1. PSSDDUT ;BIR/LDT-Pharmacy Data Management DD Utility ;09/15/97
  1. ;;1.0;PHARMACY DATA MANAGEMENT;**13,18,19,38,56,119,201**;9/30/97;Build 25
  1. ;
  1. SCH ;Called from DRUG file (50), Unit Dose Schedule field 62.04
  1. ;(Replaces EN^PSGS0)
  1. ;*119 Allow multi-word schedules
  1. I X[""""!($A(X)=45)!(X?.E1C.E)!($L(X," ")>$S(X["PRN":4,1:3))!($L(X)>70)!($L(X)<1)!(X["P RN")!(X["PR N") K X Q
  1. I X?.E1L.E S X=$$ENLU^PSSGMI(X) I '$D(PSGOES) D EN^DDIOL(" ("_X_")","","?0")
  1. I X["Q0" K X Q
  1. ;
  1. ENOS ; order set entry
  1. S (PSGS0XT,PSGS0Y,XT,Y)="" I X["PRN"!(X="ON CALL")!(X="ONCALL")!(X="ON-CALL") G Q
  1. S X0=X I X,X'["X",(X?2.4N1"-".E!(X?2.4N)) D ENCHK^PSSGS0 S:$D(X) Y=X G Q
  1. I $S($D(^PS(51.1,"AC","PSJ",X)):1,1:$E($O(^(X)),1,$L(X))=X) D DIC^PSSGS0 I $G(XT)]"" G Q
  1. I X["@" D DW^PSSGS0 S:$D(X) Y=$P(X,"@",2) G Q
  1. I Y'>0,$S(X="NOW":1,X="ONCE":1,X="STAT":1,X="ONE TIME":1,X="ONETIME":1,X="1TIME":1,X="1 TIME":1,X="1-TIME":1,1:X="ONE-TIME") D:'$D(PSGOES) EN^DDIOL(" (ONCE ONLY)","","?0") S Y="",XT="O" G Q
  1. I $G(PSGSCH)=X S PSGS0Y=$G(PSGAT) Q
  1. ;
  1. NS I Y'>0 D:'$D(PSGOES) EN^DDIOL(" (Nonstandard schedule)","","?0") S X=X0,Y=""
  1. I $E(X,1,2)="AD" K X G Q
  1. I $E(X,1,3)="BID"!($E(X,1,3)="TID")!($E(X,1,3)="QID") S XT=1440/$F("BTQ",$E(X)) G Q
  1. S:$E(X)="Q" X=$E(X,2,99) S:'X X="1"_X S X1=+X,X=$P(X,+X,2),X2=0 S:X1<0 X1=-X1 S:$E(X)="X" X2=1,X=$E(X,2,99)
  1. S XT=$S(X["'":1,(X["D"&(X'["AD"))!(X["AM")!(X["PM")!(X["HS"&(X'["THS")):1440,X["H"&(X'["TH"):60,X["AC"!(X["PC"):480,X["W":10080,X["M":40320,1:-1) I XT<0,Y'>0 K X G Q
  1. S X=X0 I XT S:X2 XT=XT\X1 I 'X2 S:$E(X,1,2)="QO" XT=XT*2 S XT=XT*X1
  1. ;
  1. Q ;
  1. S PSGS0XT=$S(XT]"":XT,1:""),PSGS0Y=$S(Y:Y,1:"") K QX,SDW,SWD,X0,XT,Z Q
  1. ;
  1. ENSH5 ; from ^DD(55.06,26,4)
  1. S:'$D(PSGST) PSGST=$P($G(^PS(55,DA(1),5,DA,0)),"^",7),PSGDDFLG=1 G ENSH
  1. ;
  1. ENSH ;Called from MEDICATION INSTRUCTION file (51), field 5 Executable Help
  1. ;(Replaces ENSH^PSSGSH)
  1. N D,DA,DIC,DIE,DZ,Y
  1. D EN^DDIOL("'STAT', 'ONCE', 'NOW', and 'DAILY' are acceptable schedules.","","?0") I X?1"???".E F Q=1:1 Q:$P($T(HT+Q),";",3)="" S PSSHLP(Q)=$P($T(HT+Q),";",3)
  1. I X?1"???".E D EN^DDIOL(.PSSHLP) K PSSHLP
  1. I X?1"???".E R !,"(Press RETURN to continue.) ",Q:DTIME D:'$T EN^DDIOL("","","$C(7)") S:'$T Q="^" I Q="^" K:$D(PSGDDFLG) PSGDDFLG,PSGST Q
  1. K DIC S DIC="^PS(51.1,",DIC(0)="E",D="APPSJ",DIC("W")="W "" ""," I $D(PSJPWD),PSJPWD S DIC("W")=DIC("W")_"$S($D(^PS(51.1,+Y,1,PSJPWD,0)):$P(^(0),""^"",2),1:$P(^PS(51.1,+Y,0),""^"",2))"
  1. E S DIC("W")=DIC("W")_"$P(^(0),""^"",2)"
  1. I $D(PSGST) S DIC("S")="I $P(^(0),""^"",5)"_$E("'",PSGST'="O")_"=""O"""
  1. D IX^DIC K DIC K:$D(PSGDDFLG) PSGDDFLG,PSGST Q
  1. ;
  1. HT ;
  1. ;; This is the frequency (ONLY) with which the doses are to be
  1. ;;administered. Several forms of entry are acceptable, such as
  1. ;;Q6H, 09-12-15, STAT, QOD, and MO-WE-FR@AD (where MO-WE-FR are
  1. ;;days of the week, and AD is the admin times). The schedule
  1. ;;will show on the MAR, labels, etc. No more than ONE space
  1. ;;(Q3H 4 or Q4H PRN) in the schedule is acceptable. If the
  1. ;;letters PRN ;;are found as part of the schedule, no admin
  1. ;;times will print on the MAR or labels, and the PICK LIST will
  1. ;;always show a count of zero (0).
  1. ;;Avoid using notation such as W/F (with food) or WM (with meals)
  1. ;;in the schedule as it may cause erroneous calculations. That
  1. ;;information should be entered into the SPECIAL INSTRUCTIONS.
  1. ;; When using the MO-WE-FR@AD schedule, please remember that
  1. ;;this type of schedule will not work properly without the "@"
  1. ;;character and at least one admin time, and that at least the
  1. ;;first two letters of each weekday entered is needed.
  1. ;
  1. ;
  1. ENDLP ;Called from Pharmacy System file (59.7), field 60.1 BAXTER ATC
  1. ;212 DEVICE (Replaces ENDLP^PSGSET)
  1. S PSGION=$S($D(ION):ION,1:"HOME") K %ZIS S %ZIS="QN",IOP=X D ^%ZIS I POP S IOP=PSGION D ^%ZIS K %ZIS,IOP,PSGION S X="" Q
  1. D EN^DDIOL($S(X=$E(ION,1,$L(X)):$E(ION,$L(X)+1,$L(ION)),1:" "_ION),"","?0") S X=ION D ^%ZISC K %ZIS,PSGION,IOP Q
  1. ;
  1. ENSTH ;Executable help for type of schedule. (Replaces ENSTH^PSJSV0)
  1. N PSSX S PSSX=1
  1. S PSSHLP(PSSX)="The TYPE OF SCHEDULE determines how the schedule will be processed."
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="A CONTINUOUS schedule is one in which an action is to take place on a"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="regular basis, such as 'three times a day' or 'once every two days'."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="A DAY OF THE WEEK schedule is one in which the action is to take"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="place only on specific days of the week. This type of schedule"
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="should have admin times entered with it. If not, the start time of"
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="the order is used as the admin time. Whenever this type is chosen,"
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="the name of the schedule must be in the form of 'MO-WE-FR'."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. G:$S('$D(PSJPP):1,PSJPP="":1,1:PSJPP="PSJ") HOT
  1. S PSSHLP(PSSX)="A DAY OF THE WEEK-RANGE schedule is one in which the action to take"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="place only on specific days of the week, but at no specific time of"
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="day (no admin times). Whenever this type is chosen, the name of the"
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="schedule must be in the form of 'MO-WE-FR'."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. HOT S PSSHLP(PSSX)="A ONE-TIME schedule is one in which the action is to take place once"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="only at a specific date and time."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. I $S('$D(PSJPP):1,PSJPP="":1,1:PSJPP="PSJ") D WRITE Q
  1. S PSSHLP(PSSX)="A RANGE schedule is one in which the action will take place within a"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="given date range."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="A SHIFT schedule is one in which the action will take place within a"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="given range of times of day."
  1. S PSSHLP(PSSX,"F")="!",PSSX=PSSX+1
  1. D WRITE
  1. Q
  1. WRITE ;Calls EN^DDIOL to write text
  1. D EN^DDIOL(.PSSHLP) K PSSHLP
  1. Q
  1. PSS13 ;Screen for CLINIC field - PDM patch PSS*1*13
  1. N X,PSSDT
  1. S X1=DT,X2=-7 D C^%DTC S PSSDT=X
  1. I $P($G(^(0)),U,3)="C",$S('$P($G(^("I")),U):1,($P($G(^("I")),U)>PSSDT):1,(($P($G(^("I")),U)<PSSDT)&($P($G(^("I")),U,2)]"")&(DT>$P($G(^("I")),U,2))):1,1:0)
  1. Q
  1. PSS19 ;Delete DRUG GROUP/INTERACTION field #7 - PDM patch PSS*1*19
  1. S DIK="^DD(50,",DA=7,DA(1)=50 D ^DIK
  1. ;
  1. ;In File #50, delete "I" node if it is null.
  1. N PSSIEN
  1. F PSSIEN=0:0 S PSSIEN=$O(^PSDRUG(PSSIEN)) Q:'PSSIEN I $D(^PSDRUG(PSSIEN,"I")),$P(^PSDRUG(PSSIEN,"I"),"^")="" K ^PSDRUG(PSSIEN,"I")
  1. Q
  1. ;
  1. ENMEDI ; entry point from file 51, field 32.1 exectuable help PSS*1.0*201
  1. Q:$G(X)'="??"
  1. W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue or ""^"" to skip extended help text" D ^DIR Q:$D(DIRUT)
  1. W @IOF
  1. ;
  1. N PSSX,PSSHLP
  1. S PSSX=1
  1. ;
  1. S PSSHLP(PSSX)="This field allows a dispense drug from the DRUG (#50) file to be"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="associated with the DOSING CHECK FREQUENCY (#32) field value within the"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="MEDICATION INSTRUCTION (#51) file."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. S PSSHLP(PSSX)="When a value is entered for ""DOSING CHECK FREQUENCY:"" and NO drug(s) is"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="entered for ""Select DRUG(S) FOR DOSING CHK FREQ:"", the dosing check will"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="use the value for ""DOSING CHECK FREQUENCY:"" to derive a frequency for"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="all orders that have that medication instruction."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. S PSSHLP(PSSX)="When a value is entered for ""DOSING CHECK FREQUENCY:"" and a drug(s) is"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="entered for ""Select DRUG(S) FOR DOSING CHK FREQ:"", the Daily Dose Order"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="Check will ONLY use the value in ""DOSING CHECK FREQUENCY:"" to derive a"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="frequency if the order that has that medication instruction also matches"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="one of the drug(s) entered. If the drug found in the order does not"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="match a drug listed in the DRUG(S) FOR DOSING CHK FREQ field, then the"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="value of the DOSING CHECK FREQUENCY will not be used for the Daily Dose"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="Order Check."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. D WRITE
  1. W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. W @IOF
  1. Q
  1. ;
  1. ENADMSCH ; entry point from file 51.1, field 11.1 exectuable help PSS*1.0*201
  1. Q:$G(X)'="??"
  1. W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue or ""^"" to skip extended help text" D ^DIR Q:$D(DIRUT)
  1. W @IOF
  1. ;
  1. N PSSX,PSSHLP
  1. S PSSX=1
  1. ;
  1. S PSSHLP(PSSX)="This field allows a dispense drug from the DRUG (#50) file to be"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="associated with the DOSING CHECK FREQUENCY (#11) field value within the"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="ADMINISTRATION SCHEDULE (#51.1) file."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. S PSSHLP(PSSX)="When a value is entered for ""DOSING CHECK FREQUENCY:"" and NO drug(s) is"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="entered for ""Select DRUG(S) FOR DOSING CHK FREQ:"", the dosing check will"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="use the value for ""DOSING CHECK FREQUENCY:"" to derive a frequency for"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="all orders that have that schedule."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. S PSSHLP(PSSX)="When a value is entered for ""DOSING CHECK FREQUENCY:"" and a drug(s) is"
  1. S PSSHLP(PSSX,"F")="!!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="entered for ""Select DRUG(S) FOR DOSING CHK FREQ:"", the Daily Dose Order"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="Check will ONLY use the value in ""DOSING CHECK FREQUENCY:"" to derive a"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="frequency if the order that has that medication instruction also matches"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="one of the drug(s) entered. If the drug found in the order does not"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="match a drug listed in the DRUG(S) FOR DOSING CHK FREQ field, then the"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="value of the DOSING CHECK FREQUENCY will not be used for the Daily Dose"
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. S PSSHLP(PSSX)="Order Check."
  1. S PSSHLP(PSSX,"F")="!?2",PSSX=PSSX+1
  1. ;
  1. D WRITE
  1. W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. W @IOF
  1. Q
  1. ;