| 1 | PSDORN2 ;BIR/JPW,LTL-Nurse CS Infusion Order Entry (cont'd) ; 16 Feb 95
 | 
|---|
| 2 |  ;;3.0; CONTROLLED SUBSTANCES ;**66**;13 Feb 97;Build 3
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ; Reference to DPT( supported by DBIA # 1035
 | 
|---|
| 5 |  ; Reference to VA(200 supported  by DBIA # 10060
 | 
|---|
| 6 |  ; Line tag SIG^XUSESIG supported by DBIA # 10050
 | 
|---|
| 7 |  ;
 | 
|---|
| 8 | ASK ;displays order for review
 | 
|---|
| 9 |  D DISPLAY
 | 
|---|
| 10 |  W !! K DA,DIR,DIRUT S DIR(0)="Y",DIR("B")="YES",DIR("A")="Is this OK",DIR("?",1)="Answer 'YES' to send this request to pharmacy for processing,"
 | 
|---|
| 11 |  S DIR("?",2)="or 'NO' to edit or delete this request",DIR("?")="or '^' to quit and DELETE this CS order request." D ^DIR K DIR
 | 
|---|
| 12 |  I $D(DIRUT) S PSDOUT=1 D DEL Q
 | 
|---|
| 13 |  I 'Y D EDIT Q:PSDOUT  G ASK
 | 
|---|
| 14 |  I Y N X,X1 D SIG^XUSESIG S:X1="" PSDOUT=1 D:X1="" DEL Q:X1=""  D
 | 
|---|
| 15 |  .D PHARM W !! W:$D(ORD) "Your order request #"_CNT1_" of "_CNT
 | 
|---|
| 16 |  .W ?32,"Sent to Pharmacy...",!!
 | 
|---|
| 17 |  .R:$D(ORD) "Press <RET> to continue",X:DTIME,!!
 | 
|---|
| 18 |  Q
 | 
|---|
| 19 | DISPLAY ;displays order request to screen
 | 
|---|
| 20 |  K LN S $P(LN,"-",80)=""
 | 
|---|
| 21 |  W @IOF,!,?17,"Controlled Substance "
 | 
|---|
| 22 |  W:$G(PSDEM) "*INFUSION* Order Request"
 | 
|---|
| 23 |  W !!,"Patient:  ",$P($G(^DPT(PAT,0)),U),!!
 | 
|---|
| 24 |  W "Requested by",?16,": ",$P($G(^VA(200,PSDUZ,0)),"^")
 | 
|---|
| 25 |  W ?51,$S($G(PSDT(9))]"":"Needed by: "_PSDT(9),1:"Request Date: "_REQD),!,LN,!
 | 
|---|
| 26 |  W !,"Drug",?16,": ",PSDRN
 | 
|---|
| 27 |  ;W ?56,"Quantity: ",?66,PSDQTY
 | 
|---|
| 28 |  W !,"Dispensed by",?16,": N/A",?50,"Dispensed Date: N/A"
 | 
|---|
| 29 |  W !,"Disp. Location",?16,": " W:+PSDS $P($G(^PSD(58.8,+PSDS,0)),"^") W !,"Exp. Date",?16,": ",!,"Manufacturer",?16,": ",!,"Lot #",?16,": "
 | 
|---|
| 30 |  W !,"Ord. Location",?16,": ",NAOUN,!,"Order Status",?16,": ",$P($G(^PSD(58.82,1,0)),"^"),!,"Comments:"
 | 
|---|
| 31 |  I $D(^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,0)) K ^UTILITY($J,"W") F TEXT=0:0 S TEXT=$O(^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,TEXT)) Q:'TEXT  D
 | 
|---|
| 32 |  .S X=$G(^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,TEXT,0)),DIWL=5,DIWR=75,DIWF="W" D ^DIWP
 | 
|---|
| 33 |  I  D ^DIWW
 | 
|---|
| 34 |  Q
 | 
|---|
| 35 | EDIT ;edit or delete order request
 | 
|---|
| 36 |  W !!,"Edit or Delete this Order Request:  EDIT//  " R X:DTIME I '$T S PSDOUT=1 D DEL Q
 | 
|---|
| 37 |  Q:X["^"  S X=$E(X) S:X="" X="E" I "EeDd"'[X W !!,"Press <RET> to edit this order request, or enter 'D' to delete the request.",! G EDIT
 | 
|---|
| 38 |  I "Dd"[X D DEL Q
 | 
|---|
| 39 |  K DA,DIE,DR S DA=PSDA,DA(1)=PSDR,DA(2)=NAOU,DIE="^PSD(58.8,"_NAOU_",1,"_PSDR_",3,",DR="13" D ^DIE K DIE,DR
 | 
|---|
| 40 |  Q
 | 
|---|
| 41 | DEL ;deletes order request
 | 
|---|
| 42 |  S PSDOUT=1 W !!,?25,"Request being deleted...",! K DIK S DA=PSDA,DA(1)=PSDR,DA(2)=NAOU,DIK="^PSD(58.8,"_NAOU_",1,"_PSDR_",3," D ^DIK K DIK
 | 
|---|
| 43 |  Q
 | 
|---|
| 44 | PHARM ;create worksheet entry in file 58.85
 | 
|---|
| 45 |  W ?5,!!,"Processing your request now..." F  L +^PSD(58.85,0):$S($G(DILOCKTM)>0:DILOCKTM,1:3) I  Q
 | 
|---|
| 46 | ADD S PSDREC=$P(^PSD(58.85,0),"^",3)+1 I $D(^PSD(58.85,PSDREC)) S $P(^PSD(58.85,0),"^",3)=PSDREC G ADD
 | 
|---|
| 47 |  K DA,DIC,DIE,DLAYGO,DR S (DIC,DIE,DLAYGO)=58.85,DIC(0)="L",X=PSDREC D ^DIC K DIC,DLAYGO
 | 
|---|
| 48 |  L -^PSD(58.85,0)
 | 
|---|
| 49 |  S PSDRD=$S($P($G(^PSD(58.8,NAOU,1,PSDR,3,PSDA,0)),"^",2):$P(^(0),"^",2),1:DT)
 | 
|---|
| 50 |  S DA=PSDREC,DR="1////"_+PSDS_";2////"_NAOU_";3////"_PSDR_";4////"_PSDA_";5////"_PSDQTY_";6////1;12////"_PSDUZ_";19////"_PSDRD_";21////"_$P($G(^PSD(58.8,NAOU,1,PSDR,3,PSDA,2)),U,2)_";22////"_$G(PAT) D ^DIE K DIE
 | 
|---|
| 51 |  I $D(^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,0)) S ^PSD(58.85,PSDREC,1,0)=^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,0) D
 | 
|---|
| 52 |  .F WORD=0:0 S WORD=$O(^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,WORD)) Q:'WORD  S ^PSD(58.85,PSDREC,1,WORD,0)=^PSD(58.8,NAOU,1,PSDR,3,PSDA,1,WORD,0)
 | 
|---|
| 53 |  K DA,DIC,DIE,DLAYGO,DR,WORD
 | 
|---|
| 54 |  D ^PSDORN3 K PSDREC,PSDT(9)
 | 
|---|
| 55 |  Q
 | 
|---|