Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCHANGE.m

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