source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCACT.m@ 1604

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1ORCACT ; SLC/MKB - Act on orders ;4/2/02 16:41
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**7,48,92,94,141**;Dec 17, 1997
3ADD ; -- add new order via NW on pkg results tab
4 ; Requires ORDIALOG = name of pkg dialog
5 N ORPTLK,OREVENT,X S VALMBCK="" G:'$L($G(ORDIALOG)) ADQ
6 S ORPTLK=$$LOCK^ORX2(+ORVP) I 'ORPTLK W !!,$C(7),$P(ORPTLK,U,2) H 2 Q
7 D FREEZE^ORCMENU S VALMBCK="R"
8 I $G(ORTAB)'="COVER" S X=$$DELAY G:X="^" ADQ I X D G:X="^" ADQ
9 . S X=$$PTEVENT^OREVNT(+ORVP,1)
10 . S:X'="^" OREVENT=+X
11 S ORNP=$$PROVIDER^ORCMENU1 G:ORNP="^" ADQ
12 S:'$G(ORL) ORL=$$LOCATION^ORCMENU1 G:ORL["^" ADQ
13 S ORDIALOG=$O(^ORD(101.41,"AB",$E(ORDIALOG,1,63),0)) G:'ORDIALOG ADQ
14 D ADD^ORCDLG,REBLD^ORCMENU:$D(^TMP("ORNEW",$J))
15 K ORDIALOG,^TMP("ORWORD",$J),^TMP("ORECALL",$J) S VALMBCK="R"
16ADQ S:$D(^TMP("OR",$J,"CURRENT","MENU")) XQORM("HIJACK")=^("MENU")
17 D:'$D(^TMP("ORNEW",$J)) UNLOCK^ORX2(+ORVP) ;unlock if no new orders
18 Q
19 ;
20EDIT ; -- change orders
21 D EN("XX") Q
22 ;
23RENEW ; -- renew orders
24 D EN("RN") Q
25 ;
26REWRITE ; -- rewrite orders
27 N OREVENT,X S X=$$DELAY Q:X="^" I X D Q:X="^"
28 . S X=$$PTEVENT^OREVNT(+ORVP,1)
29 . S:X'="^" OREVENT=+X
30 D EN("RW") Q
31 ;
32HOLD ; -- hold orders
33 D EN("HD") Q
34 ;
35UNHOLD ; -- release hold on orders
36 D EN("RL") Q
37 ;
38EN(ORACT) ; -- start here with:
39 ; ORNMBR = #,#,...,# of selected orders
40 ; ORACT = action to be taken on orders
41 ;
42 ; OREBUILD defined on return if Orders tab needs to be rebuilt
43 ;
44 N ORI,NMBR,ORQUIT,ORIFN,ORIG,ORSIG,OREL,ORPTLK,ORLK,IDX,ORDITM,ORPRINT,ORERR,ORDER,ORSTS,ORPRNT,ORNOW,ORDG,ORXNP S VALMBCK=""
45 S ORPTLK=$$LOCK^ORX2(+ORVP) I 'ORPTLK W !!,$C(7),$P(ORPTLK,U,2) H 2 Q
46 I '$G(ORNMBR) S ORNMBR=$$ORDERS^ORCHART("") G:'ORNMBR ENQ
47 D FREEZE^ORCMENU S VALMBCK="R" K OREBUILD
48 S ORNP=$$PROVIDER^ORCMENU1 G:ORNP="^" ENQ
49 S:'$G(ORL) ORL=$$LOCATION^ORCMENU1 G:ORL="^" ENQ
50EN1 F ORI=1:1:$L(ORNMBR,",") S NMBR=$P(ORNMBR,",",ORI) D:NMBR Q:$D(ORQUIT)
51 . S IDX=$G(^TMP("OR",$J,ORTAB,"IDX",NMBR))
52 . S ORIFN=$S(ORTAB="MEDS":$P(IDX,U,4),1:$P(IDX,U)) Q:'ORIFN
53 . I '$D(^OR(100,+ORIFN,0)) W !,"This order has been deleted!" H 2 Q
54 . S:'$P(ORIFN,";",2) ORIFN=+ORIFN_";"_+$P($G(^OR(100,+ORIFN,3)),U,7)
55 . S ORIG=+ORIFN,ORDITM=$$ORDITEM(ORIFN) D SUBHDR(ORDITM)
56 . I '$$VALID^ORCACT0(ORIFN,ORACT,.ORERR) W !,ORERR H 2 Q
57 . I $$NMSP^ORCD(+$P(^OR(100,+ORIFN,0),U,14))="PS" D PROVIDER^ORCDPSIV Q:$G(ORQUIT)
58 . S ORLK=$S('$D(^TMP("ORNEW",$J,ORIG)):$$LOCK1^ORX2(ORIG),1:1) I 'ORLK W !,$P(ORLK,U,2) H 2 Q
59 . D @(ORACT_"^ORCACT4") ;sets ^TMP("ORNEW",$J,ORIFN),[ORIFN]
60 . D:'$O(^TMP("ORNEW",$J,ORIG,0)) UNLK1^ORX2(ORIG) ;unlk if not chngd
61 S:$O(^TMP("ORNEW",$J,0)) OREBUILD=1
62ENQ D:'$D(^TMP("ORNEW",$J)) UNLOCK^ORX2(+ORVP) ;unlock if no new orders
63 S:$G(ORXNP) ORNP=ORXNP
64 Q
65 ;
66ORDITEM(ID) ; -- Returns order text
67 ;N X,I,MORE S X=""
68 ;I $P(ID,";",2)>1 S I=$P($G(^OR(100,+ID,8,+$P(ID,";",2),0)),U,2),X=$S(I="DC":"Discontinue ",I="HD":"Hold ",1:"")
69 ;S I=$O(^OR(100,+ID,1,0)) Q:'I "" S MORE=$O(^(I)),X=X_$G(^(I,0))
70 ;I $L(X)>68 S MORE=1,X=$E(X,1,68)
71 ;S:MORE X=X_" ..."
72 N X,ORX D TEXT^ORQ12(.ORX,ID,68) S X=ORX(1)_$S(ORX>1:" ...",1:"")
73 Q X
74 ;
75SUBHDR(X) ; -- Display subheader of order being acted on
76 W !!,?(36-($L(X)\2)),"-- "_X_" --",!
77 Q
78 ;
79DELAY() ; -- Delay release of orders?
80 I '$D(^ORD(100.5,"C")) Q 0 ;no active events
81 N X,Y,DIR S DIR(0)="YA",DIR("B")="NO"
82 S DIR("A")="Delay release of these orders? "
83 S DIR("?")="Enter NO to release these orders immediately upon signature; YES will delay release of these orders until the specified patient movement occurs."
84 D ^DIR S:$D(DTOUT)!$D(DUOUT) Y="^"
85 Q Y
86 ;
87EX ; -- exit action
88 I $G(OREBUILD) D ;rebuild tabs
89 . I $G(ORTAB)="ORDERS"!($G(ORTAB)="DELAY") D Q
90 .. N TAB D TAB^ORCHART(ORTAB,1)
91 .. F TAB="MEDS","CONSULTS" S:$D(^TMP("OR",$J,TAB,0)) $P(^(0),U)=""
92 . S:$D(^TMP("OR",$J,"ORDERS",0)) $P(^(0),U)="" ;rebld next time
93 . D:$G(ORTAB)="NEW" INIT^ORCMENU2 ;when called from RV
94 I $G(ORTAB)'="NEW",$D(^TMP("OR",$J,"CURRENT","MENU")) S XQORM("HIJACK")=^("MENU")
95 Q
Note: See TracBrowser for help on using the repository browser.