source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCB.m@ 1046

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

revised back to 6/30/08 version

File size: 6.7 KB
Line 
1ORCB ;SLC/MKB-Notifications followup for LMgr chart ;4/5/01 21:32
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**7,36,48,70,108,116**;Dec 17, 1997
3EN(DFN,ORFLG,DGRP,DEL) ; -- main entry point
4 Q:'$G(DFN) Q:'$G(ORFLG)
5 N BEG,END D SLCT1^ORQPT
6 S DGRP=$P($G(^ORD(100.98,+$G(DGRP),0)),U,3) S:'$L(DGRP) DGRP="ALL"
7 S (BEG,END)="" I ORFLG=6 D ;get BEG from XQAID for New Orders
8 . S BEG=$P(XQAID,";",3) I BEG'?7N1".".6N!(BEG'<DT) S BEG="" Q
9 . S BEG=$$FMADD^XLFDT(BEG,,,-5),END=$$NOW^XLFDT
10 I ORFLG=9 D ;get BEG from Current Admission
11 . N ADM S ADM=+$G(^DPT(DFN,.105)) S:ADM ADM=+$P($G(^DGPM(ADM,0)),U)
12 . S END=$$NOW^XLFDT,BEG=$S(ADM:ADM,1:$$FMADD^XLFDT(END,-30))
13 S ^TMP("OR",$J,"ORDERS",0)="^^"_BEG_";"_END_";"_ORFLG_";"_DGRP_";L"
14 D EN^VALM("ORCB NOTIFICATIONS")
15 Q
16 ;
17INIT ; -- init variables and list array
18 S ORTAB="ORDERS" D TAB^ORCHART("ORDERS",1)
19 I VALMCNT=1,$G(^TMP("OR",$J,ORTAB,1,0))["No data available" D
20 . N X,I S X=" No "_$S(ORFLG=5:"expiring",ORFLG=11:"unsigned",ORFLG=12:"flagged",9:"unverified",1:"new")_" orders found."
21 . F I="ORDERS","CURRENT" S ^TMP("OR",$J,I,1,0)=$$LJ^XLFSTR(X,45)_"|"
22 Q
23 ;
24HELP ; -- help code
25 N X S VALMBCK=""
26 W !!,"Enter the display numbers of the orders you wish to act on;"
27 W !,"select either DT for a detailed listing of information about each"
28 W !,"order, or the desired action. Enter Q to exit."
29 W !!,"Press <return> to continue ..." R X:DTIME
30 Q
31 ;
32PHDR ; -- protocol menu header code
33 N NUM,ORI,ORDEF,I,X K ORNMBR,OREBUILD
34 S VALMSG=$$MSG^ORCHART D SHOW^VALM
35 S NUM=+$P($G(^TMP("OR",$J,"CURRENT",0)),U,2)
36 S XQORM("#")=$O(^ORD(101,"B","ORCB ACTIONS",0))_"^1:"_NUM
37 S ORI=$S(ORFLG=5:1,ORFLG=11:"2,3,4",ORFLG=12:"3,4,5,6,7",1:8)
38 S ORDEF=$S(ORFLG=5:1,ORFLG=11:9,ORFLG=12:5,1:10)
39 F I=1:1:$L(ORI,",") S X=$T(ACTIONS+$P(ORI,",",I)),XQORM("KEY",$P(X,";",3))=$O(^ORD(101,"B","ORC "_$P(X,";",4)_" ORDERS",0))_"^1"
40 S XQORM("KEY","DT")=$O(^ORD(101,"B","ORC DETAILED DISPLAY",0))_"^1"
41 I +$P($G(^TMP("OR",$J,"CURRENT",0)),U,2)>0,XQORM("B")="Quit" S X=$T(ACTIONS+ORDEF),X=$P(X,";",4),XQORM("KEY",$P(X," "))=$O(^ORD(101,"B","ORC "_X_" ORDERS",0))_"^1",XQORM("B")=$$LOWER^VALM1(X)_" Orders" ; default action
42 S:'$G(ORL) ORL=$$FINDLOC ; attempt to determine location from orders
43 Q
44 ;
45SELECT ; -- process selected order(s)
46 N MENU,XQORM,Y,ORNMBR,OREBUILD,ORY S VALMBCK=""
47 S ORNMBR=$P(XQORNOD(0),"=",2) D SELECT^ORCHART(ORNMBR)
48 S:'$G(ORFLG) ORFLG=$P($P(^TMP("OR",$J,"CURRENT",0),U,3),";",3)
49 S MENU=$S(ORFLG=5:"EXPIRING",ORFLG=11:"UNSIGNED",ORFLG=12:"FLAGGED",1:"NEW")
50 S XQORM=$O(^ORD(101,"B","ORCB "_MENU_" MENU",0))_";ORD(101,"
51 I 'XQORM W !!,"ERROR" H 2 G SQ
52 S XQORM(0)="1AD",XQORM("A")="Select action: "
53 W ! D EN^XQORM G:Y'>0 SQ M ORY=Y
54 I $D(^ORD(101,+$P(ORY(1),U,2),20)) X ^(20) S VALMBCK="R"
55 I $G(OREBUILD) D:ORFLG=12 UNFLAG D TAB^ORCHART(ORTAB,1) Q
56SQ D DESELECT^ORCHART(ORNMBR)
57 Q
58 ;
59UNFLAG ; -- Unflag orders
60 N X,ORI,NUM,ORIFN,ORA
61 S X=$P(ORY(1),U,3) Q:(X="Unflag")!(X="Detailed Display")
62 F ORI=1:1:$L(ORNMBR,",") S NUM=$P(ORNMBR,",",ORI) I NUM D
63 . S ORIFN=$P(^TMP("OR",$J,"CURRENT","IDX",NUM),U) Q:'ORIFN
64 . S ORA=+$P(ORIFN,";",2),ORIFN=+ORIFN Q:'ORA
65 . Q:'$D(^OR(100,ORIFN)) Q:(X="Edit")&($P(^(ORIFN,3),U,3)'=12)
66 . S $P(^OR(100,ORIFN,8,ORA,3),U)=0 ; Unflag
67 Q
68 ;
69EN1(ORIFN,ACTION) ; -- entry point to display single order
70 Q:'ORIFN Q:'$D(^OR(100,ORIFN))
71 Q:"^^NEW^RENEW^REPLACE^"'[(U_$G(ACTION)_U)
72 S DFN=+$P(^OR(100,ORIFN,0),U,2) Q:'DFN
73 S ^TMP("ORXPND",$J,0)=ORIFN_U_$G(ACTION)
74 D EN1^ORCXPND(DFN,ORIFN)
75 K ^TMP("ORXPND",$J),^TMP("OR",$J)
76 Q
77 ;
78NEW ; -- Add new order as follow-up action
79 N IFN,TYPE,ORIG,ORNP,ORPTLK S VALMBCK="" K ^TMP("ORNEW",$J)
80 S ORPTLK=$$LOCK^ORX2(+ORVP) I 'ORPTLK W !!,$C(7),$P(ORPTLK,U,2) H 2 Q
81 S ORNP=$$PROVIDER^ORCMENU1,VALMBCK="R" G:ORNP="^" NWQ
82 I '$G(ORL) S ORL=$$LOCATION^ORCMENU1 G:ORL["^" NWQ
83 S ORIG=+$P($G(^TMP("ORXPND",$J,0)),U),IFN=+$P($G(^OR(100,+ORIG,0)),U,5)
84 G:'IFN NWQ S TYPE=$P($G(^ORD(101.41,IFN,0)),U,4)
85 ; If 2.5 order, use DG or PKG to get dlg
86 D FULL^VALM1,ORDER^ORCMENU
87 I $O(^TMP("ORNEW",$J,0)) D SIGN,NOTIF^ORCMENU2
88 K ^TMP("ORNEW",$J) S VALMBCK="R"
89NWQ D UNLOCK^ORX2(+ORVP)
90 Q
91 ;
92EDIT ; -- Edit order as follow-up action
93 N OREBUILD K ^TMP("ORNEW",$J)
94 D EDIT^ORCACT I $G(OREBUILD) D
95 . D SIGN,NOTIF^ORCMENU2
96 . S $P(^TMP("ORXPND",$J,0),U,2)=""
97 K ^TMP("ORNEW",$J) S VALMBCK="R"
98 D UNLOCK^ORX2(+ORVP)
99 Q
100 ;
101RENEW ; --Renew order as follow-up action
102 N OREBUILD K ^TMP("ORNEW",$J)
103 D RENEW^ORCACT I $G(OREBUILD) D
104 . D SIGN,NOTIF^ORCMENU2
105 . S $P(^TMP("ORXPND",$J,0),U,2)=""
106 . K ^TMP("ORXPND",$J) D INIT^ORCXPND
107 K ^TMP("ORNEW",$J) S VALMBCK="R"
108 D UNLOCK^ORX2(+ORVP)
109 Q
110 ;
111SIGN ; -- Sign new order
112 N ORIFN,ORTAB,ORNMBR,CNT
113 S ORTAB="NEW",(ORIFN,CNT)=0,ORNMBR=""
114 F S ORIFN=+$O(^TMP("ORNEW",$J,ORIFN)) Q:ORIFN'>0 S CNT=CNT+1,^TMP("OR",$J,"NEW","IDX",CNT)=ORIFN,ORNMBR=ORNMBR_CNT_","
115 I CNT D EN^ORCSIGN K ^TMP("OR",$J,"NEW","IDX")
116 Q
117 ;
118EXIT ; -- exit action
119 I $P($P(^TMP("OR",$J,"CURRENT",0),U,3),";",3)=12 D ; flagged orders
120 . Q:'$$GET^XPAR("ALL","ORPF AUTO UNFLAG")
121 . N ORI,ORIFN,ORA,XQAKILL,ORN,ORUNF
122 . S ORUNF=+$E($$NOW^XLFDT,1,12)_U_DUZ_"^Auto-Unflagged"
123 . S ORI=0 F S ORI=$O(^TMP("OR",$J,"CURRENT","IDX",ORI)) Q:ORI'>0 S ORIFN=$P(^(ORI),U),ORA=+$P(ORIFN,";",2) I ORIFN,$D(^OR(100,+ORIFN,0)) S $P(^(8,ORA,3),U)=0,$P(^(3),U,6,8)=ORUNF ; unflag
124 . S ORN=+$O(^ORD(100.9,"B","FLAGGED ORDERS",0))
125 . S XQAKILL=$$XQAKILL^ORB3F1(ORN) D:$D(XQAID) DELETE^XQALERT
126 D EXIT^ORCHART
127 Q
128 ;
129ACTIONS ;;KEY;NAME
130 ;;RN;RENEW
131 ;;$;SIGN
132 ;;DC;DISCONTINUE
133 ;;ED;CHANGE
134 ;;UF;UNFLAG
135 ;;HD;HOLD
136 ;;RL;UNHOLD
137 ;;VF;VERIFY
138 ;;;SIGN ALL
139 ;;;VERIFY ALL
140 ;
141ALL ; -- Select ALL orders
142 N X,Y,DIR,MAX
143 S MAX=+$P($G(^TMP("OR",$J,"CURRENT",0)),U,2),X="1-"_MAX,Y=""
144 S DIR(0)="L^1:"_MAX,DIR("V")="" D:MAX ^DIR
145 S ORNMBR=Y
146 Q
147 ;
148FINDLOC() ; -- Loop through orders in alert to find assigned location
149 N ORI,ORIFN,ORY S ORI=0,ORY=""
150 F S ORI=$O(^TMP("OR",$J,"CURRENT","IDX",ORI)) Q:ORI'>0 S ORIFN=+^(ORI),ORX=$P($G(^OR(100,ORIFN,0)),U,10) S:ORY="" ORY=ORX I ORY'="",ORX'=ORY S ORY="" Q ; ORY=location for all orders, or "" if different
151 Q ORY
152 ;
153DELETE ; -- Delete current alert
154 N %,%Y,X,Y,PRMT,XQAKILL S VALMBCK="",XQAKILL=1
155 S PRMT="Your "_$S(ORFLG=5:"Expiring",ORFLG=11:"Unsigned",ORFLG=12:"Flagged",ORFLG=9:"Unverified",1:"New")_" Orders alert for "_$G(ORPNM)_" will be deleted!"
156D1 W !!,PRMT,!,"Are you sure" S %=2 D YN^DICN
157 I (%<0)!(%=2) W !,"Nothing deleted." H 2 Q
158 I %=0 D G D1
159 . W !!,"This action will delete the alert you are currently processing; the alert will",!,"disappear automatically when all orders have been acted on, but this action may",!,"be used to remove the alert if some orders are to be left unchanged."
160 . W !,"Press <return> to continue ..." R X:DTIME
161 W !,"Removing alert ..." D:$D(XQAID) DEL^ORB3FUP1(.Y,XQAID)
162 I $G(Y)="TRUE" W " done." S VALMBCK="Q",DEL=1 H 2
163 E W " unable to delete alert." H 2
164 Q
Note: See TracBrowser for help on using the repository browser.