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

LRBLPUS2.m

Go to the documentation of this file.
LRBLPUS2 ; IHS/DIR/AAB - PATIENT UNIT SELECTION 11/12/96 09:51 ;
 ;;5.2;LR;**1002**;JUN 01, 1998
 ;;5.2;LAB SERVICE;**139**;Sep 27, 1994
 S X=$P(F,"^",7)_"000" D H^%DTC S O(1)=%H,O(2)=$S(X'[".":0,1:$E(X,9,10)*60+$E(X,11,12))
 S X="N",%DT="T" D ^%DT K %DT S X=Y_"000" D H^%DTC S H(1)=%H,H(2)=$E(X,9,10)*60+$E(X,11,12)
 S L=O(1)-H(1) I 'O(2) W !,$P(F,"^",2)," EXPIRE" W:L>0 "S IN ",L,$S(L>1:" DAYS",1:" DAY") W:'L&'(O(2)) "S TODAY" I L<0 W $C(7),"D ",-1*L,$S(L=-1:" DAY",1:" DAYS")," AGO !",! Q
 I O(2) D T Q:'$D(L)
 S I=+F F A=0:0 S A=$O(^LRD(65,I,2,A)) Q:'A  I $D(^LRD(65,"AP",A,I)) S X=^LR(A,0),Y=$P(X,U,3),X=$P(X,U,2),X=^DIC(X,0,"GL"),N=@(X_Y_",0)") W !,"Assigned/xmatched to ",$P(N,U,1)," ",$P(N,U,9)
 ;W !!,"UNIT OK for ",LRP," ",SSN,"  " S %=1 D YN^LRU Q:%'=1  L -^LRD(65,I)
 W !!,"UNIT OK for ",LRP," ",HRCN,"  " S %=1 D YN^LRU Q:%'=1  L -^LRD(65,I)  ;IHS/ANMC/CLS 11/1/95
 S:$D(G(1)) LRI(1)=$O(^LRO(68,LRAA,1,G(1),1,G(3),4,0))
 I $D(G(1)),$S($D(^LRO(68,LRAA,1,G(1),1,G(3),4,LRI,0)):1,$D(^LRO(68,LRAA,1,G(1),1,G(3),4,+LRI(1),0)):1,1:0) S X=^(0),^(0)=$P(X,"^")_"^"_$P(X,"^",2)_"^"_$P(X,"^",3)_"^"_DUZ_"^"_DT,$P(^LR(LRDFN,LRSS,$P(G,"^",2),0),"^",3)=DT D ORD K G(1)
 L +^LRD(65,I,2) S:'$D(^LRD(65,I,2,0)) ^(0)="^65.01IA^^" I '$D(^(LRDFN,0)) S ^(0)=LRDFN,X=^LRD(65,I,2,0),^(0)="^65.01IA^"_LRDFN_"^"_($P(X,"^",4)+1)
 L -^LRD(65,I,2) I 'C(9)!(C(9)=2&('$D(G))) G END
 L +^LRD(65,I,2) S:'$D(^LRD(65,I,2,LRDFN,1,0)) ^(0)="^65.02DA^^" S X=$P(G,"^",2)
 I '$D(^LRD(65,I,2,LRDFN,1,X)) S ^(X,0)=+G_"^"_LRS_"^"_LRMD_"^^^"_$P(G,"^",3)_"^"_LRS(1)_"^"_LRMD(1),Y=^LRD(65,I,2,LRDFN,1,0),^(0)="^65.02DA^"_X_"^"_($P(Y,"^",4)+1),^LRD(65,I,2,LRDFN,1,"B",+G,X)=""
 L -^LRD(65,I,2) I C(9)'=1 G END
 L +^LR(LRDFN,1.8) S:'$D(^LR(LRDFN,1.8,0)) ^(0)="^63.084PA^^" I '$D(^LR(LRDFN,1.8,C,0)) S ^(0)=C,Y=^LR(LRDFN,1.8,0),^(0)="^63.084PA^"_C_"^"_($P(Y,"^",4)+1)
 S:'$D(^LR(LRDFN,1.8,C,1,0)) ^(0)="^63.0841PA^^" I '$D(^(I,0)) S ^(0)=I_"^"_X,Y=^LR(LRDFN,1.8,C,1,0),^(0)="^63.0841PA^"_I_"^"_($P(Y,"^",4)+1)
 L -^LR(LRDFN,1.8) Q
 ;
T S M=O(2)-H(2) S:M<0 L=L-1,O(2)=O(2)+1440,M=O(2)-H(2) S H=M\60,M=M#60 W ! W:L>0 L," DAY",$S(L=1:" ",1:"S ")
 I L>-1 W:H>0 H," HOUR",$S(H=1:" ",1:"S ") W:M>0 M," MINUTE",$S(M=1:" ",1:"S ") W:(H+M)>0 " LEFT" Q
 W !,$C(7),"UNIT EXPIRED ",-1*L,$S(-1*L:" DAY(S) ",1:" "),H," HOUR(S) ",M," MINUTE(S) AGO" K L Q
 ;
ORD S Y=^LRO(68,LRAA,1,G(1),1,G(3),0),Y(4)=$P(Y,"^",4),Y(5)=$P(Y,"^",5) I Y(4),Y(5),$D(^LRO(69,Y(4),1,Y(5),3)) S $P(^(3),"^",2)=DT
 Q
 ;
END S DIE="^LRD(65,I,2,",DA=LRDFN,DA(1)=I,DR=".02///NOW;S X(1)=X" D ^DIE K DIE,DR,DA S X=^LRD(65,I,0),Y(7)=$P(X,"^",7),Y(8)=$P(X,"^",8),Y=X(1) D DT^LRU
 ;S Y(1)=$P(X,"^")_"^"_LRP_" "_SSN_"^"_"Patient "_LRPABO_" "_LRPRH_" "_Y_"^"_"Unit    "_Y(7)_" "_Y(8)_" # "_$P(X,"^")_"   "_LRWHO_"^"_"NO CROSSMATCH REQUIRED"
 S Y(1)=$P(X,"^")_"^"_LRP_" "_HRCN_"^"_"Patient "_LRPABO_" "_LRPRH_" "_Y_"^"_"Unit    "_Y(7)_" "_Y(8)_" # "_$P(X,"^")_"   "_LRWHO_"^"_"NO CROSSMATCH REQUIRED"  ;IHS/ANMC/CLS 11/1/95
 D EN^LRBLPX Q