source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCHANGE.m@ 613

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

initial load of WorldVistAEHR

File size: 6.1 KB
Line 
1ORCHANGE ;SLC/MKB-Change View utilities ; 08 May 2002 2:12 PM
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**27,72,141,243**;Dec 17, 1997;Build 242
3EN ; -- Change view of current list
4 N XQORM,Y,ORI
5 S XQORM=$G(^TMP("OR",$J,"CURRENT","CHANGE")),VALMBCK=""
6 I 'XQORM W !!,"No other views of this list currently available" H 2 Q
7 S Y=$S(ORTAB="NOTES"!(ORTAB="SUMMRIES"):"1\",ORTAB="ORDERS":"\",1:"")
8 S XQORM(0)=Y_"AD" K Y
9 S XQORM("A")=$S($L($G(^ORD(101,+XQORM,28))):^(28),1:"Select attribute(s) to change: ")
10 D EN^XQORM S ORI=0
11 F S ORI=$O(Y(ORI)) Q:ORI'>0 X:$D(^ORD(101,+$P(Y(ORI),U,2),20)) ^(20)
12 I $G(^TMP("OR",$J,"CURRENT",0))'=$G(^TMP("OR",$J,ORTAB,0)) K VALMBG D TAB^ORCHART(ORTAB,1)
13 Q
14 ;
15RANGE ; -- Get new date range for list
16 N HDR,OLD,NEW,REQ,BEG,END
17 S HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3)
18 S REQ=$S(ORTAB="XRAYS":1,ORTAB="REPORTS":1,1:0)
19 I ($P(HDR,";",3)=2)!($P(HDR,";",3)=5) D Q
20 . N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,THISTS
21 . S THISTS=" only active "
22 . I $P(HDR,";",3)=5 S THISTS=" expiring "
23 . W !,"Date range can not be selected when viewing"_THISTS_"orders."
24 . S DIR(0)="E" D ^DIR
25 S OLD=$P(HDR,";"),NEW=$$START(OLD,REQ) Q:NEW="^" S BEG=NEW
26 I BEG="" S END="" G RQ
27 S OLD=$P(HDR,";",2),NEW=$$STOP(OLD,REQ) Q:NEW="^" S END=NEW
28 I END<BEG S NEW=END,END=BEG,BEG=NEW ; switch
29RQ S $P(HDR,";",1,2)=$P(BEG,U,2)_";"_$P(END,U,2)
30 S $P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
31 Q
32 ;
33START(CURRENT,REQD) ; -- Return new beginning date
34 N X,Y,DIR
35 S DIR(0)="DA"_$S('$G(REQD):"O",1:"")_"^::ETX",DIR("A")="Beginning Date[/time]: "
36 S:$L($G(CURRENT)) DIR("B")=$S(CURRENT?7N.1".".6N:$$FMTE^XLFDT(CURRENT),1:CURRENT)
37 S DIR("?")="Enter the earliest date [and time] from which you want to see data; a null response will return all data on this patient"
38 D ^DIR S:$D(DTOUT) Y="^" S:X="@" Y="" S:Y Y=Y_U_X
39 Q Y
40 ;
41STOP(CURRENT,REQD) ; -- Return new ending date
42 N X,Y,DIR
43 S DIR(0)="DA"_$S('$G(REQD):"O",1:"")_"^::ETX",DIR("A")="Ending Date[/time]: "
44 S:$L($G(CURRENT)) DIR("B")=$S(CURRENT?7N.1".".6N:$$FMTE^XLFDT(CURRENT),1:CURRENT)
45 S DIR("?")="Enter the latest date [and time] for which you want to see data; a null response will assume TODAY"
46 D ^DIR S:$D(DTOUT) Y="^" S:X="@" Y="" S:Y Y=Y_U_X
47 Q Y
48 ;
49MAX ; -- Get new max # of items to list
50 N X,Y,DIR
51 S HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3),X=$P(HDR,";",5)
52 S DIR(0)="NAO^1:999" S:X DIR("B")=X
53 S DIR("A")="Maximum # of items to display: "
54 S DIR("?")="Enter the total number of items you wish to be displayed here"
55 D ^DIR Q:'Y
56 S $P(HDR,";",5)=Y,$P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
57 Q
58 ;
59AUTHOR(USER) ; -- Select new author of note
60 N X,Y,DIC D FULL^VALM1 S VALMBCK="R"
61 S DIC=200,DIC(0)="AEQM",DIC("A")="Select AUTHOR: "
62 S:$G(USER) DIC("B")=$P($G(^VA(200,+USER,0)),U)
63 D ^DIC S:Y'>0 Y=""
64 Q +Y
65 ;
66LISTHDR ; -- List available subhdrs
67 N HDR,DONE,CNT D FULL^VALM1
68 W !!,"Choose from:" S HDR="",(CNT,DONE)=0,VALMBCK="R"
69 F S HDR=$O(^TMP("OR",$J,"CURRENT","HDR",HDR)) Q:HDR="" D Q:DONE
70 . S CNT=CNT+1 I CNT>(IOSL-2) S CNT=0 I '$$MORE^ORCD S DONE=1 Q
71 . W !," "_HDR
72 Q
73 ;
74LRSUB ; -- Return lab subscript to jump to in list
75 ; Available subscripts in ^TMP("OR",$J,"IDX",name)=line #
76 I '$D(^TMP("OR",$J,"CURRENT","HDR")) W !!,"There are no section headers defined for this report." H 3 Q
77 N X,Y,DIR,XP,P,CNT,MATCH D FULL^VALM1 S VALMBCK="R"
78LRS S DIR(0)="FAO^1:30",DIR("A")="Select Lab Section: "
79 S DIR("A",1)="Available sections in this report:",X=""
80 F I=2:1 S X=$O(^TMP("OR",$J,"CURRENT","HDR",X)) Q:X="" S DIR("A",I)=" "_X
81 S DIR("?")="Enter the lab section from which to wish to see results; the display will scroll to the top of the selected section" ;,DIR("??")="^D LISTHDR^ORCHANGE"
82 D ^DIR Q:"^"[Y
83 S XP=$$UP^XLFSTR(X)
84 I $G(^TMP("OR",$J,"CURRENT","HDR",XP)) S VALMBG=^(XP),VALMBCK="R" Q
85 S CNT=0,P=XP F S P=$O(^TMP("OR",$J,"CURRENT","HDR",P)) Q:$E(P,1,$L(XP))'=XP S CNT=CNT+1,MATCH(CNT)=+$G(^(P))_U_P ; line# ^ hdr name
86 I 'CNT W $C(7)," ??" G LRS
87 I CNT=1 S VALMBG=+MATCH(CNT),VALMBCK="R",P=$P(MATCH(1),U,2) W $E(P,$L(X)+1,$L(P)) Q
88LRS1 K DIR S DIR(0)="NAO^1:"_CNT,DIR("A")="Select 1-"_CNT_": "
89 F I=1:1:CNT S DIR("A",I)=I_" "_$P(MATCH(I),U,2)
90 S DIR("?")="Select the lab section you want to go to, by number"
91 D ^DIR Q:$D(DTOUT)!($D(DUOUT)) I 'Y K DIR G LRS
92 S VALMBG=+MATCH(Y),VALMBCK="R"
93 Q
94 ;
95DGROUP ; -- Select new service (display group)
96 N X,Y,Z,ZZ,DIC,HDR,DONE,HELP
97 D FULL^VALM1 S VALMBCK="R"
98 S HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3),Z=$P(HDR,";",4),ZZ=+$O(^ORD(100.98,"B",$S($L(Z):Z,1:"ALL"),0))
99 S HELP="Enter the service or section from which you wish to see orders for this patient."
100 S DONE=0 F D Q:DONE
101 . W !!,"Select Service/Section: "_$P(^ORD(100.98,+ZZ,0),U)_"//"
102 . R X:DTIME S:'$T X="^" I X["^" S DONE=1 Q
103 . I X="" S DONE=1 Q ; no change
104 . I X["?" W !!,HELP,!,"Choose from:" D DG^ORCHANG1(1,"DISP") Q
105 . S DIC=100.98,DIC(0)="NEQZ" D ^DIC S:Y>0 Z=$P(Y(0),U,3),ZZ=+Y,DONE=1
106 S $P(HDR,";",4)=Z,$P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
107 Q
108 ;
109CS ; -- Select new consult service
110 N GMRCDG,GMRCBUF,GMRCACT,GMRCQUT,GMRCGRP,HDR
111 D FULL^VALM1,ASRV^GMRCASV S VALMBCK="R" Q:$D(GMRCQUT)
112 S:$G(GMRCDG) HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3),$P(HDR,";",4)=GMRCDG,$P(^(0),U,3,4)=HDR_U
113 K ^TMP("GMRCS",$J),^TMP("GMRCSLIST",$J)
114 Q
115 ;
116REMOVE ; -- Remove preferred view
117 N ORDEL S ORDEL=1
118SAVE ; -- Save current view as preferred
119 Q:'$$OK($G(ORDEL)) N X,Y,PARAM
120 S X=$S($G(ORDEL):"@",1:$P($G(^TMP("OR",$J,ORTAB,0)),U,3)),Y=""
121 ;S:$G(ORTAB)="MEDS" Y=$S($P(X,";",3):"IN",1:"OUT")_"PT "
122 S:$G(ORTAB)="LABS" Y=$S($G(ORWARD):"IN",1:"OUT")_"PT "
123 S PARAM="ORCH CONTEXT "_Y_$G(ORTAB)
124 D EN^XPAR("USR",PARAM,1,X) W " ...done." H 1
125 Q
126 ;
127OK(DEL) ; -- Are you sure you want to save/remove view of ORTAB?
128 N X,Y,DIR S DIR(0)="YA"
129 S DIR("A")="Are you sure you want to "_$S($G(DEL):"remove",1:"save the current view as")_" your preference? "
130 S:$G(DEL) DIR("?",1)="Enter YES if you wish to remove your preferred view of this chart tab and use",DIR("?")="the default view next time, or NO to quit without changing anything."
131 S:'$G(DEL) DIR("?",1)="Enter YES if you wish to use these same parameters again the next time the ",DIR("?")=$$LOWER^VALM1(ORTAB)_" tab is created for you, or NO to quit without saving anything."
132 D ^DIR
133 Q +Y
134 ;
135RETURN ; -- Return to preferred view of ORTAB
136 S $P(^TMP("OR",$J,ORTAB,0),U,4)=1
137 Q
Note: See TracBrowser for help on using the repository browser.