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

ORCHANGE.m

Go to the documentation of this file.
  1. ORCHANGE ;SLC/MKB-Change View utilities ; 08 May 2002 2:12 PM
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**27,72,141,243**;Dec 17, 1997;Build 242
  1. EN ; -- Change view of current list
  1. N XQORM,Y,ORI
  1. S XQORM=$G(^TMP("OR",$J,"CURRENT","CHANGE")),VALMBCK=""
  1. I 'XQORM W !!,"No other views of this list currently available" H 2 Q
  1. S Y=$S(ORTAB="NOTES"!(ORTAB="SUMMRIES"):"1\",ORTAB="ORDERS":"\",1:"")
  1. S XQORM(0)=Y_"AD" K Y
  1. S XQORM("A")=$S($L($G(^ORD(101,+XQORM,28))):^(28),1:"Select attribute(s) to change: ")
  1. D EN^XQORM S ORI=0
  1. F S ORI=$O(Y(ORI)) Q:ORI'>0 X:$D(^ORD(101,+$P(Y(ORI),U,2),20)) ^(20)
  1. I $G(^TMP("OR",$J,"CURRENT",0))'=$G(^TMP("OR",$J,ORTAB,0)) K VALMBG D TAB^ORCHART(ORTAB,1)
  1. Q
  1. ;
  1. RANGE ; -- Get new date range for list
  1. N HDR,OLD,NEW,REQ,BEG,END
  1. S HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3)
  1. S REQ=$S(ORTAB="XRAYS":1,ORTAB="REPORTS":1,1:0)
  1. I ($P(HDR,";",3)=2)!($P(HDR,";",3)=5) D Q
  1. . N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,THISTS
  1. . S THISTS=" only active "
  1. . I $P(HDR,";",3)=5 S THISTS=" expiring "
  1. . W !,"Date range can not be selected when viewing"_THISTS_"orders."
  1. . S DIR(0)="E" D ^DIR
  1. S OLD=$P(HDR,";"),NEW=$$START(OLD,REQ) Q:NEW="^" S BEG=NEW
  1. I BEG="" S END="" G RQ
  1. S OLD=$P(HDR,";",2),NEW=$$STOP(OLD,REQ) Q:NEW="^" S END=NEW
  1. I END<BEG S NEW=END,END=BEG,BEG=NEW ; switch
  1. RQ S $P(HDR,";",1,2)=$P(BEG,U,2)_";"_$P(END,U,2)
  1. S $P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
  1. Q
  1. ;
  1. START(CURRENT,REQD) ; -- Return new beginning date
  1. N X,Y,DIR
  1. S DIR(0)="DA"_$S('$G(REQD):"O",1:"")_"^::ETX",DIR("A")="Beginning Date[/time]: "
  1. S:$L($G(CURRENT)) DIR("B")=$S(CURRENT?7N.1".".6N:$$FMTE^XLFDT(CURRENT),1:CURRENT)
  1. 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"
  1. D ^DIR S:$D(DTOUT) Y="^" S:X="@" Y="" S:Y Y=Y_U_X
  1. Q Y
  1. ;
  1. STOP(CURRENT,REQD) ; -- Return new ending date
  1. N X,Y,DIR
  1. S DIR(0)="DA"_$S('$G(REQD):"O",1:"")_"^::ETX",DIR("A")="Ending Date[/time]: "
  1. S:$L($G(CURRENT)) DIR("B")=$S(CURRENT?7N.1".".6N:$$FMTE^XLFDT(CURRENT),1:CURRENT)
  1. S DIR("?")="Enter the latest date [and time] for which you want to see data; a null response will assume TODAY"
  1. D ^DIR S:$D(DTOUT) Y="^" S:X="@" Y="" S:Y Y=Y_U_X
  1. Q Y
  1. ;
  1. MAX ; -- Get new max # of items to list
  1. N X,Y,DIR
  1. S HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3),X=$P(HDR,";",5)
  1. S DIR(0)="NAO^1:999" S:X DIR("B")=X
  1. S DIR("A")="Maximum # of items to display: "
  1. S DIR("?")="Enter the total number of items you wish to be displayed here"
  1. D ^DIR Q:'Y
  1. S $P(HDR,";",5)=Y,$P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
  1. Q
  1. ;
  1. AUTHOR(USER) ; -- Select new author of note
  1. N X,Y,DIC D FULL^VALM1 S VALMBCK="R"
  1. S DIC=200,DIC(0)="AEQM",DIC("A")="Select AUTHOR: "
  1. S:$G(USER) DIC("B")=$P($G(^VA(200,+USER,0)),U)
  1. D ^DIC S:Y'>0 Y=""
  1. Q +Y
  1. ;
  1. LISTHDR ; -- List available subhdrs
  1. N HDR,DONE,CNT D FULL^VALM1
  1. W !!,"Choose from:" S HDR="",(CNT,DONE)=0,VALMBCK="R"
  1. F S HDR=$O(^TMP("OR",$J,"CURRENT","HDR",HDR)) Q:HDR="" D Q:DONE
  1. . S CNT=CNT+1 I CNT>(IOSL-2) S CNT=0 I '$$MORE^ORCD S DONE=1 Q
  1. . W !," "_HDR
  1. Q
  1. ;
  1. LRSUB ; -- Return lab subscript to jump to in list
  1. ; Available subscripts in ^TMP("OR",$J,"IDX",name)=line #
  1. I '$D(^TMP("OR",$J,"CURRENT","HDR")) W !!,"There are no section headers defined for this report." H 3 Q
  1. N X,Y,DIR,XP,P,CNT,MATCH D FULL^VALM1 S VALMBCK="R"
  1. LRS S DIR(0)="FAO^1:30",DIR("A")="Select Lab Section: "
  1. S DIR("A",1)="Available sections in this report:",X=""
  1. F I=2:1 S X=$O(^TMP("OR",$J,"CURRENT","HDR",X)) Q:X="" S DIR("A",I)=" "_X
  1. 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"
  1. D ^DIR Q:"^"[Y
  1. S XP=$$UP^XLFSTR(X)
  1. I $G(^TMP("OR",$J,"CURRENT","HDR",XP)) S VALMBG=^(XP),VALMBCK="R" Q
  1. 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
  1. I 'CNT W $C(7)," ??" G LRS
  1. I CNT=1 S VALMBG=+MATCH(CNT),VALMBCK="R",P=$P(MATCH(1),U,2) W $E(P,$L(X)+1,$L(P)) Q
  1. LRS1 K DIR S DIR(0)="NAO^1:"_CNT,DIR("A")="Select 1-"_CNT_": "
  1. F I=1:1:CNT S DIR("A",I)=I_" "_$P(MATCH(I),U,2)
  1. S DIR("?")="Select the lab section you want to go to, by number"
  1. D ^DIR Q:$D(DTOUT)!($D(DUOUT)) I 'Y K DIR G LRS
  1. S VALMBG=+MATCH(Y),VALMBCK="R"
  1. Q
  1. ;
  1. DGROUP ; -- Select new service (display group)
  1. N X,Y,Z,ZZ,DIC,HDR,DONE,HELP
  1. D FULL^VALM1 S VALMBCK="R"
  1. 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))
  1. S HELP="Enter the service or section from which you wish to see orders for this patient."
  1. S DONE=0 F D Q:DONE
  1. . W !!,"Select Service/Section: "_$P(^ORD(100.98,+ZZ,0),U)_"//"
  1. . R X:DTIME S:'$T X="^" I X["^" S DONE=1 Q
  1. . I X="" S DONE=1 Q ; no change
  1. . I X["?" W !!,HELP,!,"Choose from:" D DG^ORCHANG1(1,"DISP") Q
  1. . S DIC=100.98,DIC(0)="NEQZ" D ^DIC S:Y>0 Z=$P(Y(0),U,3),ZZ=+Y,DONE=1
  1. S $P(HDR,";",4)=Z,$P(^TMP("OR",$J,ORTAB,0),U,3,4)=HDR_U
  1. Q
  1. ;
  1. CS ; -- Select new consult service
  1. N GMRCDG,GMRCBUF,GMRCACT,GMRCQUT,GMRCGRP,HDR
  1. D FULL^VALM1,ASRV^GMRCASV S VALMBCK="R" Q:$D(GMRCQUT)
  1. S:$G(GMRCDG) HDR=$P($G(^TMP("OR",$J,ORTAB,0)),U,3),$P(HDR,";",4)=GMRCDG,$P(^(0),U,3,4)=HDR_U
  1. K ^TMP("GMRCS",$J),^TMP("GMRCSLIST",$J)
  1. Q
  1. ;
  1. REMOVE ; -- Remove preferred view
  1. N ORDEL S ORDEL=1
  1. SAVE ; -- Save current view as preferred
  1. Q:'$$OK($G(ORDEL)) N X,Y,PARAM
  1. S X=$S($G(ORDEL):"@",1:$P($G(^TMP("OR",$J,ORTAB,0)),U,3)),Y=""
  1. ;S:$G(ORTAB)="MEDS" Y=$S($P(X,";",3):"IN",1:"OUT")_"PT "
  1. S:$G(ORTAB)="LABS" Y=$S($G(ORWARD):"IN",1:"OUT")_"PT "
  1. S PARAM="ORCH CONTEXT "_Y_$G(ORTAB)
  1. D EN^XPAR("USR",PARAM,1,X) W " ...done." H 1
  1. Q
  1. ;
  1. OK(DEL) ; -- Are you sure you want to save/remove view of ORTAB?
  1. N X,Y,DIR S DIR(0)="YA"
  1. S DIR("A")="Are you sure you want to "_$S($G(DEL):"remove",1:"save the current view as")_" your preference? "
  1. 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."
  1. 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."
  1. D ^DIR
  1. Q +Y
  1. ;
  1. RETURN ; -- Return to preferred view of ORTAB
  1. S $P(^TMP("OR",$J,ORTAB,0),U,4)=1
  1. Q