source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGTAP.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1PSGTAP ;BIR/CML3-SEND PICK LIST TO TRAVENOL'S ATC 212 (DRIVER) ; 05 May 98 / 10:25 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**10**;16 DEC 97
3 ;
4EN ;
5 D ENCV^PSGSETU I $D(XQUIT) Q
6 ;
7ASK ;
8 R !!,"Select WARD GROUP or PICK LIST: ",X:DTIME W:'$T $C(7) S:'$T X="^" G:"^"[X OUT I X=+X D NL G:'$D(X) ASK I Y D EN1 G ASK
9 I X?1."?" W !!?2,"Select a Ward Group for which a pick list has been run that you wish to send",!,"to the ATC.",!?2,"You may also directly select a Pick List by number, which prints in the upper",!,"left corner of each pick list." G ASK
10 K DIC S DIC="^PS(57.5,",DIC(0)="EIMQZ",DIC("S")="I $P(^(0),""^"",2)=""P""" D ^DIC K DIC I Y S PSGPLWG=+Y,PSGPLGF="A" D AD I $D(X) F D ^PSGPLG Q:'PSGPLG D EN1 Q:OK
11 G ASK
12 ;
13OUT ;
14 D ENKV^PSGSETU K A,BLKS,C,D,DAT,DIC,G,I1,I2,ND,O,P,PID,PL,PN,PND,PSGIOP,PSGPLG,PSGPLGF,PSGPLWG,PSGPLWGN,PSGSPD,Q,QUIT,R,S,ST,T,TM,W
15 Q
16 ;
17EN1 ;
18 S OK=0 I '$$LOCK^PSGPLUTL(PSGPLG,"PSGTAP") W $C(7),!!,"This PICK LIST is currently being accessed by another task." Q
19 I $P($G(^PS(53.5,PSGPLG,0)),"^",12) S PSGID=$P(^(0),"^",12),PSGOD=$$ENDTC^PSGMI(PSGID) D I Y<1 D EN2 Q
20 .W !! S DIR(0)="Y^A",DIR("A")="Pick List #"_PSGPLG_" was queued to the ATC for "_PSGOD_". Send again",DIR("B")="N" D ^DIR K DIR
21 S X=$G(^PS(53.5,PSGPLG,0)),Y=$O(^(0))="",X=$P(X,"^",11)&'$P(X,"^",9),%=1
22 I X!Y W $C(7) F W !!,"THIS PICK LIST HAS NO",$S(Y:" DATA.",1:"T RUN TO COMPLETION."),!,"Do you wish to continue" S %=2 D YN^DICN G:% EN2 W !!?2,"Enter 'YES' to send this pick list to the ATC. Enter 'NO' (or '^') to not",!,"send it."
23 G:%'=1 EN2 K %ZIS S %ZIS="NQ",PSGION=ION,IOP="`"_PSGIOP_";255" D ^%ZIS I POP S IOP=PSGION D ^%ZIS K IOP W $C(7),!!?10,"THE ATC MACHINE IS NOT FOUND!" G EN2
24 S PSGTAPR=0 I $D(^PS(53.55,PSGPLG,0)),$P(^(0),"^",2),$O(^(1,0)) F W !!,"This pick list had been previously started, but did not run to completion.",!,"Do you want to restart it where it left off" S %=0 D YN^DICN I 1 Q:% D
25 .W !!?2,"Enter 'YES' to restart the pick list from where it previously stopped. Enter",!,"'NO' to start this pick list from the beginning." W:%Y'?1."?" " (A response is required.)"
26 I G:%<0 EN2 S PSGTAPR=%=1
27 S X=0,X=$O(^PS(59.7,X)),PSGTIR=$S($P($G(^(X,26)),"^",2)=1:"ENQ^PSGTAP1",1:"ENQ^PSGTAP0")
28 K PSGTID,ZTSAVE S ZTDESC="PICK LIST TO ATC",(ZTSAVE("PSGPLG"),ZTSAVE("PSGSPD"),ZTSAVE("PSGTAPR"),ZTSAVE("PSGPLWG"))="" D ENTSK^PSGTI
29 I $D(ZTSK) W "...SENT!" S OK=1 I $D(ZTSK("D"))#2 S %H=ZTSK("D") D YMD^%DTC S $P(^PS(53.5,PSGPLG,0),"^",12)=X+%
30 ;
31EN2 ;
32 I $D(PSGPLG) D UNLOCK^PSGPLUTL(PSGPLG,"PSGTAP")
33 Q
34 ;
35NL ; numeric look-up
36 S Y=$G(^PS(53.5,X,0)) I $S('Y:1,'$P(Y,"^",2):1,1:'$D(^PS(53.5,"AB",$P(Y,"^",2),+$P(Y,"^",3),X))) S Y=0 Q
37 S PSGPLG=X,X=^PS(53.5,PSGPLG,0),Y=$$ENDTC^PSGMI($P(X,"^",3)),PSGPLWG=$P(X,"^",2),PSGPLWGN=$S('$D(^PS(57.5,PSGPLWG,0)):PSGPLWG_";PS(57.5,",$P(^(0),"^")]"":$P(^(0),"^"),1:PSGPLWG_";PS(57.5,"),PSGOD=$$ENDTC^PSGMI($P(X,"^",4))
38 W !?5,"Ward Group: ",PSGPLWGN,!?5,Y," thru ",PSGOD
39 ;
40AD ; ATC device
41 S X=$G(^PS(57.5,PSGPLWG,3)) I $P(X,"^",3)="" W $C(7),!!?3,"THIS WARD GROUP DOES NOT HAVE AN ATC DEVICE DESIGNATED FOR IT." K X
42 S:$D(X) PSGIOP=$P(X,"^",3),PSGSPD=$P(X,"^",2),Y=1 Q
Note: See TracBrowser for help on using the repository browser.