source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORX2.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1ORX2 ; slc/dcm - OE/RR Patient lock entry points ;4/21/04 09:46
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**16,48,158,168,183,190,195**;Dec 17, 1997
3PT1 ;;Entry point to unlock patient when done adding orders - NO LONGER USED
4 ;;Required variable ORVP.
5 Q:'$D(ORVP) Q:'$L(ORVP) Q:ORVP'["DPT("
6 D UNLOCK(+ORVP) K ORPTLK,ORELK
7 Q
8LK ;;Entry point for locking patient when updating orders
9 ;;Entry: X=VP to Patient "DFN;DPT(" Exit: Y=1 if lock succeeds
10 Q:'$D(X) Q:'$L(X) Q:X'["DPT(" Q:'$D(@("^"_$P(X,";",2)_+X_",0)"))
11 S Y=$$LOCK(+X) Q:Y
12 W !!,$C(7),$P(Y,U,2) D READ
13 S Y=0 K X
14 Q
15ULK ;;Entry point to unlock patient
16 ;;Required variable X=VP to patient.
17 Q:'$D(X) Q:'$L(X) Q:X'["DPT(" Q:'$D(@("^"_$P(X,";",2)_+X_",0)"))
18 D UNLOCK(+X)
19 Q
20 ;
21LOCK(DFN) ; -- Lock patient chart (silent)
22 ; Returns 1 if successful, or 0^Message if could not get lock
23 ;
24 Q:'$G(DFN) "0^Invalid patient" N Y,ORLK,NOW,NOW1
25 S ORLK=$G(^XTMP("ORPTLK-"_DFN,1)) Q:ORLK=(DUZ_U_$J) 1 ;locked
26 L +^XTMP("ORPTLK-"_DFN):1 I '$T S Y="0^"_$S(+ORLK:$P($G(^VA(200,+ORLK,0)),U),1:"Another person")_" is editing orders for this patient." Q Y
27 S NOW=$$NOW^XLFDT,NOW1=$$FMADD^XLFDT(NOW,1)
28 S ^XTMP("ORPTLK-"_DFN,0)=NOW1_U_NOW_"^CPRS Chart Lock",^(1)=DUZ_U_$J
29 Q 1
30 ;
31UNLOCK(DFN) ; -- Unlock patient chart (silent)
32 L -^XTMP("ORPTLK-"_DFN)
33 I $G(^XTMP("ORPTLK-"_DFN,1))=(DUZ_U_$J) K ^XTMP("ORPTLK-"_DFN)
34 Q
35 ;
36INC(IFN) ;Increment zero node on file 100.2
37 N X,X3,X4
38 Q:'$G(IFN) 1 Q:$D(^OR(100.2,IFN)) 1
39 L +^OR(100.2,0):5 I '$T Q 0
40 S:'$D(^OR(100.2,0)) ^(0)="OE/RR PATIENT^100.2P" S X=^(0)
41 S X4=+$P(X,U,4)+1,X3=$S(IFN>$P(X,U,3):IFN,1:$P(X,U,3))
42 S $P(^OR(100.2,0),U,3,4)=X3_U_X4
43 L -^OR(100.2,0)
44 Q 1
45 ;
46LOCK1(ORDER) ; -- Lock ORDER in file #100
47 ; Returns 1 if successful or 0^Message if could not get lock
48 ;
49 N X,Y,NOW,NOW1 I '$G(ORDER) Q "0^Invalid order number"
50 ;DBIA #4001 Private DBIA w CMOP
51 I $D(^XTMP("ORLK-"_ORDER,0)),(^(0)["CPRS/CMOP") Q "0^CMOP Transmission"
52 L +^OR(100,+ORDER):1 I '$T S X=+$G(^XTMP("ORLK-"_+ORDER,1)),Y="0^"_$S(X:$P($G(^VA(200,X,0)),U),1:"Another person")_" is working on this order." Q Y
53 I $P($G(^OR(100,+ORDER,0)),U,12)="I" S Y=+$P($G(^(3)),U,6) I Y,$P($G(^OR(100,Y,3)),U,3)=11 D Q Y
54 . S X=$S($P(^OR(100,Y,3),U,11)=2:"renewal",1:"edit")
55 . S Y="0^An unreleased "_X_" exists for this order." L -^OR(100,+ORDER)
56 S NOW=$$NOW^XLFDT,NOW1=$$FMADD^XLFDT(NOW,1)
57 S ^XTMP("ORLK-"_+ORDER,0)=NOW1_U_NOW_"^CPRS Order Lock",^(1)=DUZ_U_$J
58 Q 1
59 ;
60UNLK1(ORDER) ; -- Unlock ORDER in file #100
61 ;DBIA #4001 CMOP
62 S ORDER=+ORDER Q:'ORDER
63 I $D(^XTMP("ORLK-"_ORDER,0)),(^(0)["CPRS/CMOP") D Q
64 . I $J'=$P($G(^XTMP("ORLK-"_ORDER,1)),U,2) Q
65 . L -^OR(100,ORDER) K ^XTMP("ORLK-"_ORDER)
66 L +^OR(100,ORDER):1
67 I '$T Q
68 E L -^OR(100,ORDER)
69 L -^OR(100,ORDER) K ^XTMP("ORLK-"_ORDER)
70 Q
71 ;
72READ ; -- instead of READ^ORUTL
73 N X,Y,DIR
74 S DIR(0)="EA",DIR("A")=" Press return to continue "
75 D ^DIR
76 Q
77 ;
78LCKEVT(EVT) ;Function atttempts to lock event, added w/patch 194
79 N J
80 F J=1:1:5 L +^ORE(100.2,EVT,0):1 Q:$T H 1
81 Q $T
82 ;
83UNLEVT(EVT) ;Unlocks global, added w/patch 195
84 L -^ORE(100.2,EVT,0)
85 Q
Note: See TracBrowser for help on using the repository browser.