source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDRF4.m@ 1800

Last change on this file since 1800 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1PSDRF4 ;BIR/JPW,LTL-Nurse RF damaged dose ; 8 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;**25,60**;13 Feb 97
3 ;Reference to ^PSD(58.8 are covered by DBIA #2711
4 ;Reference to ^PSD(58.81 are covered by DBIA #2808
5 ;Reference to ^PSDRUG( are covered by DBIA #221
6 ;Reference to $$WITNESS^XUVERIFY are covered by DBIA #1513
7 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
8 I $P($G(^VA(200,DUZ,20)),U,4)']"" N XQH S XQH="PSD ESIG" D EN^XQH G END
9 S PSDUZ=DUZ,(MSG,MSG1)=0,Y=DT X ^DD("DD") S REQD=Y
10NURSE N X,X1 D SIG^XUSESIG I X1="" G END
11NAOU ;select NAOU to dispense from
12 I $G(NAOU) S PSDS=+$P(^PSD(58.8,NAOU,0),U,4) G DRUG
13 W !!,"Please enter the ward from which the defective drug(s) will be destroyed."
14 K DA,DIC S DIC=58.8,DIC(0)="QEA",DIC("A")="Select Ward: "
15 S DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S('$D(^(""I"")):1,'^(""I""):1,+^(""I"")>DT:1,1:0),$P(^(0),""^"",2)=""N"",'$P(^(0),""^"",7)"
16 W ! D ^DIC K DIC G:Y<0 END S NAOU=+Y,NAOUN=$P(Y,"^",2)
17 I '$D(^PSD(58.8,NAOU,0)) S MSG=1 D MSG G END
18 I '$O(^PSD(58.8,NAOU,1,0)) S MSG=1,MSG1=2 D MSG G END
19 I '$P(^PSD(58.8,NAOU,0),U,4) S MSG=2 D MSG G END
20 S PSDS=+$P(^PSD(58.8,NAOU,0),"^",4),PSDS=PSDS_"^"_+$P(^PSD(58.8,+PSDS,0),"^",5) I '+PSDS S (MSG,MSG1)=1 D MSG G END
21 I '$D(^PSD(58.8,+PSDS,0)) S MSG=2 D MSG G END
22 I '$O(^PSD(58.8,+PSDS,1,0)) S MSG=2,MSG1=2 D MSG G END
23DRUG ;select drug
24 N DIR,PSD,PSDR,PSDQ,PSDDT
25 S DIR(0)="FAO^1:40"
26 S DIR("A")="Scan Drug Label or Enter Label # or Drug: "
27 W ! D ^DIR K DIR G:$D(DIRUT) END
28 I $L(Y)=1,Y'=" " W $C(7),!!,"Please enter more than one character.",! G DRUG
29 I $O(^PSD(58.81,"D",Y,0)) D
30 .S PSD=0
31 .F S PSD=$O(^PSD(58.81,"D",Y,PSD)) Q:'PSD S PSD(1)=$G(^PSD(58.81,PSD,0)) I $P(PSD(1),U,11)>3,$P(PSD(1),U,18)=NAOU S PSDR=$P(PSD(1),U,5),PSDPN=$P(PSD(1),U,17),PSDTYP=17
32 I $D(PSDR),PSDR'=Y D
33 .I $D(^PSDRUG(Y)),$D(^PSD(58.8,NAOU,1,Y)) D
34 ..S PSDDT=$$FMDIFF^DILIBF(DT,$P(PSD(1),U,4),"")
35 ..I PSDDT>365 S PSDR=Y
36 .I '$D(^PSDRUG(Y)),$D(PSD(1)) D
37 ..S PSDDT=$$FMDIFF^DILIBF(DT,$P(PSD(1),U,4),"")
38 ..I PSDDT>365 K PSDR
39 .I '$D(^PSDRUG(Y)),'$D(^PSD(58.8,NAOU,1,Y)),'$D(PSDR) W $C(7),!!,"This is not a valid Pharmacy Dispensing number for this ward.",!! G END
40 D:'$G(PSDR) G:$D(DTOUT)!($D(DUOUT)) END G:Y<1 DRUG
41 .S DIC="^PSD(58.8,NAOU,1,",DIC(0)="EMQSZ",DA(1)=NAOU
42 .W ! D ^DIC K DIC I $D(DTOUT)!($D(DUOUT))!(Y<1) W $C(7),!!,"This is not a valid Pharmacy Dispensing number for this ward.",!! Q
43 .S PSDR=+Y,PSDTYP=9,PSDRE="DEFECTIVE DOSE"
44 I '$G(PSDR) W $C(7),!!,"This is not a valid Pharmacy Dispensing number for this ward.",!! G END
45 W:$G(PSDR) !!,$P($G(^PSDRUG(PSDR,0)),U)
46BAL S PSDR(1)=$G(^PSD(58.8,NAOU,1,PSDR,0)),OQTY=$P(PSDR(1),U,4)
47 I 'OQTY W !!,"Sorry, this drug has a zero balance." G DRUG
48 ;PSD*3*25 (DAVE B)
49 K PSDDAVE D ^PSDRFV I $G(PSDDAVE)=1 K PSDDAVE S PSDOUT=1 G END
50 S DIR(0)="Y",DIR("A")="Starting Balance: "_OQTY_" "_$P(PSDR(1),U,8)_" Correct count"
51 S DIR("B")="Yes",NUR1=DUZ
52 S DIR("?")="Answer Yes if the amount on hand equals the starting balance."
53 W ! D ^DIR K DIR G:$D(DIRUT) END
54 I Y=0 D ^PSDRF2 G:$G(PSDOUT) END S $P(PSDR(1),U,4)=PSDQ(1),OQTY=PSDQ(1),PSDTYP=17
55LIQ G:$P($G(^PSD(58.8,+PSDS,1,PSDR,7)),U) ^PSDRF5
56DEF W ! S DIR(0)="NA^.01:"_OQTY_":2",DIR("A")="Amount defective: "
57 S DIR("B")=1 D ^DIR K DIR G:$D(DIRUT) END S (PSDQ,WQTY)=Y
58WIT S NUR2=$$WITNESS^XUVERIFY("WITNESS")
59 I NUR2=DUZ W !!,"Wait a minute, you can't witness yourself!",$C(7) G WIT
60 I NUR2'>0 S PSDOUT=1 Q
61 W !!,"Thank you, ",$S($P($G(^VA(200,NUR2,.1)),U,4)]"":$P($G(^(.1)),U,4),1:$P($G(^VA(200,NUR2,0)),U))
62 W !!,"Remaining Balance: ",$P(PSDR(1),U,4)-PSDQ," ",$P(PSDR(1),U,8)
63 D UPDAT^PSDRF1
64END W:$G(PSDOUT) !!,"No dose signed out.",$C(7),!! K %,%DT,%H,%I,CNT,CNT1,DA,DIC,DIE,DINUM,DIR,DIROUT,DIRUT,DIWF,DIWL,DIWR,DR,DTOUT,DUOUT,LN,MSG,MSG1,NUR2,WQTY
65 K NAOU,NAOUN,NBKU,NPKG,OK,OKTYP,ORD,PSDA,PSDEM,PSDOUT,PSDQTY,PSDRD,PSDR,PSDRN,PSDS,PSDT,PSDUZ,PSDUZN,PSDPN,PSDTYP,PSDRE,OQTY,REQD,TEXT,TYPE,WORD,NUR1,X,Y
66 Q
67MSG ;display error message
68 W $C(7),!!,?10,"Contact your Pharmacy Coordinator.",!,?10,"This "_$S(MSG=2:"Dispensing Site",MSG=1:"NAOU",1:"Drug")_" is missing "
69 W $S(MSG1=1:"Primary Disp. Site",MSG1=2:"stocked drugs",MSG1=3:"narcotic breakdown unit",MSG1=4:"narcotic package size",1:"data")_".",!
70 Q
Note: See TracBrowser for help on using the repository browser.