1 | PSGPL ;BIR/CML3-PICK LIST ;12 DEC 97 / 10:01 AM
|
---|
2 | ;;5.0; INPATIENT MEDICATIONS ;**50**;16 DEC 97
|
---|
3 | ;
|
---|
4 | ; Reference to ^PS(59.7 is supported by DBIA #2181.
|
---|
5 | ;
|
---|
6 | BEGIN ; get ward group, last pick list # for group, see if it's a rerun.
|
---|
7 | ; ND2 - 2 node of WARD GROUP file or WARD GROUP^^start date^stop date from pick list ) node
|
---|
8 | ; PSGPLG - pick list number PSGPLWG - ward group number
|
---|
9 | ; PSGPLF - start date PSGPLWGP - 5 node from WARD GROUP
|
---|
10 | ;
|
---|
11 | D ENCV^PSGSETU,NOW^%DTC S PSGDT=%,RERUN=0
|
---|
12 | N PSJSITE,PSJPRN S PSJSITE=0,PSJSITE=$O(^PS(59.7,PSJSITE)) I $P($G(^(PSJSITE,26)),U,5)=1 S PSJPRN=1
|
---|
13 | S DIC("S")="I $P(^(0),""^"",2)=""P""",DIC(0)="QEAMI",DIC="^PS(57.5," W ! D ^DIC K DIC G:Y'>0 DONE S PSGPLWG=+Y,ND2=$G(^PS(57.5,+Y,2)),PSGPLWGP=$G(^(5)),PSGPLG=+ND2
|
---|
14 | I 'ND2,$D(^PS(53.5,"A",PSGPLWG)) F Q=0:0 S Q=$O(^PS(53.5,"A",PSGPLWG,Q)) Q:'Q I '$O(^(Q)),$D(^PS(53.5,Q,0)) S ND2=$P(^(0),"^",2)_"^^"_$P(^(0),"^",3,4),PSGPLG=Q Q
|
---|
15 | I PSGDT<$P(ND2,"^",3) D RERUN G UL:%<0,BEGIN:%=2
|
---|
16 | I ND2]"" D DTEXST S PSGOD=$$ENDTC^PSGMI(PSGPLS) W !,"Start date/time for this pick list: ",PSGOD S MES="STOP" D GETSF G:Y<0 DONE S PSGPLF=Y G BOTH
|
---|
17 | F MES="START","STOP" D GETSF G:Y<0 DONE
|
---|
18 | ;
|
---|
19 | BOTH ;
|
---|
20 | W ! F L +^PS(53.5,0):1 I S ND=$G(^PS(53.5,0)) S:ND="" ND="PICK LIST^53.5" Q
|
---|
21 | F PSGPLG=$P(ND,"^",3)+1:1 I '$D(^PS(53.5,PSGPLG)) I $$LOCK^PSGPLUTL(PSGPLG,"PSGPL") S $P(ND,"^",3)=PSGPLG,$P(ND,"^",4)=$P(ND,"^",4)+1,^PS(53.5,0)=ND Q
|
---|
22 | L -^PS(53.5,0)
|
---|
23 | D ENPL^PSGTI I $D(IO("Q")) G:'$D(ZTSK) UL W !!,"Pick list queued!" D SET G UL
|
---|
24 | I POP W !!,"No device chosen for Pick List ",$E("re",1,RERUN),"run." G UL
|
---|
25 | W !,"...this may take a while...(you really should QUEUE the pick list)..." D SET,EN^PSGPL1
|
---|
26 | ;
|
---|
27 | UL ;
|
---|
28 | D UNLOCK^PSGPLUTL(PSGPLG,"PSGPL")
|
---|
29 | ;
|
---|
30 | DONE ;
|
---|
31 | D ^%ZISC,ENKV^PSGSETU K AM,DIC,FD,FFF,MES,ND,ND2,OG,OS,POP,PSGION,PSGID,PSGOD,PSGPLF,PSGPLG,PSGPLS,PSGPLWG,PSGPLWGP,Q,RERUN,ST,XX,ZTOUT,PSGDT,EST Q
|
---|
32 | ;
|
---|
33 | SET ;
|
---|
34 | I RERUN S DIK="^PS(53.5,",DA=OG D ^DIK K DIK I $D(^PS(57.5,PSGPLWG,2)),+^(2)=OG S ^(2)=$P(^(2),"^",6,20)
|
---|
35 | S ^PS(53.5,PSGPLG,0)=PSGPLG_"^"_PSGPLWG_"^"_PSGPLS_"^"_PSGPLF_"^^"_$P(PSGPLWGP,"^",1,3)_"^^^"_PSGDT_"^^"_$P(PSGPLWGP,"^",7),^PS(57.5,PSGPLWG,2)=PSGPLG_"^"_PSGDT_"^"_PSGPLS_"^"_PSGPLF_"^"_DUZ_"^"_$P(ND2,"^",1,15),^PS(53.5,"A",PSGPLWG,PSGPLG)=""
|
---|
36 | S DIK="^PS(53.5,",DA=PSGPLG D IX^DIK K DIK Q
|
---|
37 | ;
|
---|
38 | DTEXST ;
|
---|
39 | S PSGPLS=$$EN^PSGCT($P(ND2,"^",4),1),X=$$ENDTC^PSGMI($P(ND2,"^",4)),Y=$$ENDTC^PSGMI($P(ND2,"^",3)),XX=$$ENDTC^PSGMI($P(ND2,"^",2))
|
---|
40 | W !!,"The PICK LIST for this WARD GROUP was last run",$S(XX:" on "_XX,1:""),!," for ",Y," through ",X,!
|
---|
41 | I $D(^PS(53.5,PSGPLG,0)),$P(^(0),"^",11),'$P(^(0),"^",9) W $C(7),$C(7),!,"*** THIS PICK LIST HAS NOT RUN TO COMPLETION. ***",!
|
---|
42 | Q
|
---|
43 | ;
|
---|
44 | GETSF ;
|
---|
45 | K %DT S %DT="AERTX",%DT("A")="Enter "_MES_" date/time for this pick list: "
|
---|
46 | I MES["O",$D(^PS(57.5,PSGPLWG,0)),$P(^(0),"^",3) S X=$$EN^PSGCT(PSGPLS,$P(^(0),"^",3)*60-1),Y=$$ENDD^PSGMI(X),%DT("B")=Y
|
---|
47 | GETSF1 D ^%DT I Y<0 W $C(7),!!,"This PICK LIST cannot be ",$E("re",1,RERUN),"run without a ",MES," date." Q
|
---|
48 | S @($S(MES["O":"PSGPLF",1:"PSGPLS"))=Y I MES["O",(Y'>PSGPLS) W $C(7),!!,"*** Stop date must be greater than start date !! ***",! G GETSF1
|
---|
49 | Q
|
---|
50 | ;
|
---|
51 | RERUN ;
|
---|
52 | I '$$LOCK^PSGPLUTL(PSGPLG,"PSGPL") W $C(7),!!,"** THE NEXT PICK LIST FOR THIS WARD GROUP IS CURRENTLY RUNNING. **" S %=2 Q
|
---|
53 | D DTEXST F W !,"Do you want to rerun this pick list" S %=0 D YN^DICN Q:% D:%Y]"" DTQ W:%Y="" $C(7)," (Answer required.)"
|
---|
54 | I %=1 S OG=PSGPLG,OS=$P(^PS(53.5,OG,0),"^",3),RERUN=2 S:+ND2=OG ND2=$P(ND2,"^",6,20) D UNLOCK^PSGPLUTL(PSGPLG,"PSGPL") Q
|
---|
55 | D UNLOCK^PSGPLUTL(PSGPLG,"PSGPL") Q
|
---|
56 | ;
|
---|
57 | DTQ ;
|
---|
58 | W !!?2,"Enter a 'Y' to rerun this pick list. Enter an 'N' (or '^') to NOT rerun this pick list. NOTE: Rerunning a pick list deletes all of its old data.",! Q
|
---|