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

PSSLOCK.m

Go to the documentation of this file.
  1. PSSLOCK ;BIR/RSB-Pharmacy patient lock ;09/15/97 13:30
  1. ;;1.0;PHARMACY DATA MANAGEMENT;**26,58,125**;9/30/97;Build 2
  1. ;
  1. ; Reference to ^ORX2 supported by DBIA #867
  1. ; Reference to ^PS(53.1 supported by DBIA #2140
  1. ; Reference to ^PS(52.41 supported by DBIA #2844
  1. ; Reference to ^PSRX supported by DBIA #2845
  1. ; Reference to ^PS(55 supported by DBIA #2191
  1. ;
  1. L(DFN,DIS) ;
  1. I $G(PSONOLCK) Q 1
  1. N FLAG S ^XTMP("PSSLOCK",0)=$$PDATE
  1. I '$D(^XTMP("PSSLOCK",DFN)) D Q FLAG
  1. . D NOW^%DTC S ^XTMP("PSSLOCK",DFN)=DUZ_"^"_%
  1. . L +^XTMP("PSSLOCK",DFN):$S($G(DILOCKTM)>0:DILOCKTM,1:3) S FLAG=$S($T=1:$T,1:0)
  1. I $D(^XTMP("PSSLOCK",DFN)) Q $$R
  1. UL(DFN) ; unlock
  1. I $G(PSONOLCK) Q
  1. L -^XTMP("PSSLOCK",DFN) K ^XTMP("PSSLOCK",DFN)
  1. Q
  1. ;
  1. R() ; check lock on node
  1. ;if user has same patient already locked, Q 1, will only lock once
  1. I $P($G(^XTMP("PSSLOCK",DFN)),"^")=DUZ Q 1
  1. L +^XTMP("PSSLOCK",DFN):$S($G(DILOCKTM)>0:DILOCKTM,1:3)
  1. I $T=1 D NOW^%DTC S ^XTMP("PSSLOCK",DFN)=DUZ_"^"_% Q 1
  1. I $T=0 W:DIS=1 !,$$WHO(DFN) S Y=$P($G(^XTMP("PSSLOCK",DFN)),"^",2) X ^DD("DD") Q $S(DIS=0:0_"^"_$P($G(^VA(200,+$P($G(^XTMP("PSSLOCK",DFN)),"^"),0)),"^")_"^"_Y,1:0)
  1. ;
  1. PDATE() ;
  1. N X1,X2 S X1=DT,X2=+14 D C^%DTC
  1. Q X_"^"_DT_"^Pharmacy patient locks"
  1. ;
  1. WHO(DFN) ;
  1. S Y=$P($G(^XTMP("PSSLOCK",DFN)),"^",2) X ^DD("DD")
  1. Q $P($G(^VA(200,+$P($G(^XTMP("PSSLOCK",DFN)),"^"),0)),"^")_" is editing orders for this patient ("_Y_")"
  1. ;
  1. ;
  1. LS(DFN,X) ;
  1. ;LOCK CPRS ORDER
  1. ;DFN is patient #, X is PSJORD OR PSGORD
  1. N OR100 S OR100=$$ORD(DFN,X) I OR100=0 Q 1
  1. N L S L=$$LOCK1^ORX2(OR100)
  1. I L Q 1
  1. I 'L W !,$P(L,"^",2),$C(7) D PAUSE^VALM1 Q 0
  1. Q 0
  1. ;
  1. UNL(DFN,X) ;
  1. ; unlocks order in file 100
  1. ; DFN is patient #, X is PSJORD OR PSGORD
  1. D UNLK1^ORX2($$ORD(DFN,X))
  1. Q
  1. ;
  1. ORD(DFN,X) ;
  1. ; return order number in file 100 from entry in 53.1 or 55.
  1. ; DFN is patient #, X is PSJORD OR PSGORD
  1. N ORD100
  1. S ORD100=$S(X["N"!(X["P"):"^PS(53.1,"_+X_",0)",X["V":"^PS(55,"_DFN_",""IV"","_+X_",0)",1:"^PS(55,"_DFN_",5,"_+X_",0)",1:"NA")
  1. Q +$P(@ORD100,"^",21)
  1. ;
  1. PSOL(X) ;
  1. S PSOMSG=1
  1. I X["S" D Q
  1. .S X=+$P($G(^PS(52.41,+$G(X),0)),"^") I X S PSOMSG=$$LOCK1^ORX2(X)
  1. S X=+$P($G(^PSRX(+$G(X),"OR1")),"^",2) I X S PSOMSG=$$LOCK1^ORX2(X)
  1. Q
  1. PSOUL(X) ;
  1. I X["S" D Q
  1. .S X=+$P($G(^PS(52.41,+$G(X),0)),"^") I X D UNLK1^ORX2(X)
  1. S X=+$P($G(^PSRX(+$G(X),"OR1")),"^",2) I X D UNLK1^ORX2(X)
  1. Q