source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORCHTAB1.m@ 1211

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

initial load of WorldVistAEHR

File size: 8.2 KB
Line 
1ORCHTAB1 ;SLC/MKB-Build Chart-tabs cont ;6/14/02 12:49
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**2,27,58,72,141,189**;Dec 17, 1997
3EN ; -- rebuild ORTAB listing
4 Q:'$L($T(@ORTAB)) G @ORTAB
5 Q
6 ;
7DT(X) ; -- Returns FM date for X
8 N Y,%DT S %DT="T",Y="" D:X'="" ^%DT
9 Q Y
10 ;
11COVER ; -- cover sheet
12 N LBL,X
13 F LBL="GMRA","CWAD","GMRV","IMM","SC" D @(LBL_"^ORCHTAB2"),BLANK^ORCHTAB
14 S ORMENU="ORCHART COVER MENU",DEFCXT=1
15 S ORTITLE="Cover Sheet",ORACTNS="ORC COVER ACTIONS",ORRM=81
16 S ORCAPTN("ITEM")="Item",ORCAPTN("DATA")="Entered",ORCAPTN("MORE")=""
17 Q
18 ;
19NOTES ; -- progress notes
20 N BEG,END,STS,AUTHOR,ORY,ORI,ORX,OCCLIM,SUBJ
21 I '$L(CONTEXT) S CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT NOTES"),DEFCXT=1,OCCLIM=$P($$PERSPRF^TIULE(DUZ),U,10) S:+OCCLIM>0 $P(CONTEXT,";",5)=OCCLIM
22 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),STS=$P(CONTEXT,";",3),AUTHOR=$P(CONTEXT,";",4),OCCLIM=$P(CONTEXT,";",5),SUBJ=$P(CONTEXT,";",6)
23 D CONTEXT^TIUSRVLO(.ORY,3,STS,+ORVP,BEG,END,AUTHOR,OCCLIM) S ORI=0
24 I $L($G(ORY)) F S ORI=$O(@ORY@(ORI)) Q:ORI'>0 S ORX=@ORY@(ORI) D NOTE^ORCHTAB2
25 S ORTITLE=$S(STS=2:"Unsigned",STS=3:"Uncosigned",1:"Signed")_" Notes"_$S(AUTHOR:" by "_$$LNAMEF^ORCHTAB(AUTHOR),1:"")
26 S ORCAPTN("ITEM")="Title",ORCAPTN("DATA")="Written Author SigSt",ORCAPTN("MORE")=""
27 S ORACTNS="ORC TIU ACTIONS",ORCHANGE="ORCHANGE NOTES",ORRM=81
28 S ORMENU="ORCHART NOTES MENU" K @ORY
29 Q
30 ;
31SUMMRIES ; -- discharge summary
32 N BEG,END,STS,AUTHOR,ORY,ORI,ORX
33 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT SUMMRIES"),DEFCXT=1
34 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),STS=$P(CONTEXT,";",3),AUTHOR=$P(CONTEXT,";",4)
35 D CONTEXT^TIUSRVLO(.ORY,244,STS,+ORVP,BEG,END,AUTHOR) S ORI=0
36 I $L($G(ORY)) F S ORI=$O(@ORY@(ORI)) Q:ORI'>0 S ORX=@ORY@(ORI) D SUMM^ORCHTAB2
37 S ORCAPTN("ITEM")="Title",ORCAPTN("DATA")="Ref Date Author SigSt",ORCAPTN("MORE")="Admitted Discharged "
38 S ORACTNS="ORC TIU ACTIONS",ORMENU="ORCHART SUMMARIES MENU",ORCHANGE="ORCHANGE NOTES",ORRM=114
39 S ORTITLE=$S(STS=2:"Unsigned",STS=3:"Uncosigned",1:"Signed")_" D/C Summaries"_$S(AUTHOR:" by "_$$LNAMEF^ORCHTAB(AUTHOR),1:"") K @ORY
40 Q
41 ;
42PROBLEMS ; -- problem list
43 N COMM,ST,ORY,ORI,ORX
44 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT PROBLEMS"),DEFCXT=1
45 S ST=$P(CONTEXT,";",3),COMM=$P(CONTEXT,";",4) ;,PROV=$P(CONTEXT,";",5)
46 D LIST^GMPLUTL2(.ORY,+ORVP,ST,COMM)
47 S ORI=0 F S ORI=$O(ORY(ORI)) Q:ORI'>0 S ORX=ORY(ORI) D PROB^ORCHTAB2
48 S ORCAPTN("ITEM")="Problem",ORCAPTN("DATA")="Onset Updated Status",ORCAPTN("MORE")=""
49 S ORTITLE=$S(ST="A":"Active",ST="I":"Inactive",1:"All")_" Problems"
50 S ORACTNS="ORC PROBLEM ACTIONS",ORCHANGE="ORCHANGE PROBLEMS",ORRM=81
51 S ORMENU="ORCHART PROBLEMS MENU"
52 Q
53 ;
54NEW ; -- new orders in ORNEW()
55 N OREVENT S CONTEXT=";;19;ALL;L",DEFCXT=1 G ORDERS
56DELAY ; -- delayed orders [from ORCACT3]
57 N OREVENT S CONTEXT=";;24;ALL;L",DEFCXT=1 G ORDERS
58 ;
59ORDERS ; -- orders
60 N DGRP,STS,BEG,END,ORLIST,ORIFN,ORI,MULT,ORYD,FRMT,DELAY,EVT
61 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT ORDERS"),DEFCXT=1
62 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2))
63 S DGRP=$P(CONTEXT,";",4),FRMT=$P(CONTEXT,";",5),EVT=$P(CONTEXT,";",8)
64 S:'$L(DGRP) DGRP="ALL" S DGRP=+$O(^ORD(100.98,"B",DGRP,0))
65 S STS=+$P(CONTEXT,";",3),DELAY=$S("^15^16^17^24^25^26^"[(U_STS_U):1,'EVT:0,$P($G(^ORE(100.2,+EVT,1)),U,5):1,$O(^ORE(100.2,"DAD",+EVT,0)):1,1:0)
66 S MULT=$S("^1^6^8^9^10^11^13^14^20^22^"[(U_STS_U):1,1:0)
67 S ORTITLE=$$STATUS(STS,EVT)_$S(DGRP>1:" "_$P($G(^ORD(100.98,+DGRP,0)),U,2),1:"")_" Orders",ORRM=114
68 S ORCAPTN("ITEM")="Item Ordered",ORCAPTN("MORE")="NRS CLK Chart "
69 S:FRMT="S" ORCAPTN("DATA")="Start Date Order Status"
70 S:FRMT'="S" ORCAPTN("DATA")="Provider Start Stop Sts"
71 D EN^ORQ1(ORVP,DGRP,+STS,,BEG,END,,MULT,,1,EVT),ORYD^ORDD100 ;Get list
72 S ORI=0 F S ORI=$O(^TMP("ORR",$J,ORLIST,ORI)) Q:ORI'>0 S ORIFN=$G(^(ORI)) D ORDER^ORCHTAB3:'DELAY,DELAYED^ORCHTAB3:DELAY
73 S DELAY=$S("^15^16^17^24^25^26^"[(U_STS_U):1,$G(OREVENT):1,1:0)
74 S ORACTNS="ORC "_$S(ORTAB="NEW":"NEW",DELAY:"DELAYED ORDER",$D(^XUSEC("ORES",DUZ)):"ORES ORDER",$D(^XUSEC("ORELSE",DUZ)):"ORELSE ORDER",$D(^XUSEC("OREMAS",DUZ)):"OREMAS ORDER",1:"ORDER")_" ACTIONS"
75 I ORTAB'="NEW" S ORCHANGE="ORCHANGE ORDERS "_$S(FRMT="L":"LONG",1:"SHORT")
76 K ^TMP("ORR",$J,ORLIST)
77 Q
78 ;
79STATUS(X,Y) ; -- Return name of context/status number
80 N Z I $G(Y) S Z=$$NAME^OREVNTX(Y),Z=$$LOWER^VALM1(Z) Q Z ;Event
81 S Z="All^Active^Discontinued^Completed/Expired^Expiring^Recent^Pending^Unverified^Unverified^Unverified^Unsigned^Flagged^Verbal^Unsigned Verbal^Admission^Discharge^Transfer^Held^New^Unverified^^Lapsed^Current^Delayed^O.R.^Delayed"
82 Q $P(Z,U,+X)
83 ;
84MEDS ; -- medications
85 N BEG,END,INPT,ORI,ORJ,ORX
86 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT MEDS"),DEFCXT=1
87 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2))
88 S INPT=$P(CONTEXT,";",3) S:'$L(INPT) INPT=$S($G(ORWARD):1,1:0)
89 D OCL^PSOORRL(+ORVP,BEG,END),SORT^ORCHTAB3(INPT)
90 S ORJ=0 F S ORJ=$O(^TMP("ORPS",$J,ORJ)) Q:ORJ'>0 S ORI=0 F S ORI=$O(^TMP("ORPS",$J,ORJ,ORI)) Q:ORI'>0 S ORX=$G(^TMP("PS",$J,ORI,0)) D MEDS^ORCHTAB3
91 S ORCAPTN("ITEM")="Medication",ORCAPTN("MORE")="",ORRM=81
92 S:INPT ORCAPTN("DATA")="Start Stop Status"
93 S:'INPT ORCAPTN("DATA")="Requestor Expires Status"
94 S ORACTNS="ORC "_$S(INPT:"IN",1:"OUT")_"PT MED ACTIONS",ORMENU="ORCHART MEDS MENU"
95 S ORCHANGE="ORCHANGE MEDS "_$S(INPT:"INPT",1:"OUTPT")
96 S ORTITLE=$S($L(BEG)!$L(END):"",1:"Active ")_$S(INPT:"In",1:"Out")_"patient Medications"
97 K ^TMP("PS",$J),^TMP("ORPS",$J)
98 Q
99 ;
100LABS ; -- laboratory
101 N BEG,END,TYPE,SUB,X
102 I '$L(CONTEXT) S CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT "_$S($G(ORWARD):"IN",1:"OUT")_"PT LABS"),DEFCXT=1
103 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),TYPE=$P(CONTEXT,";",3),ORRM=81
104 I TYPE="C" D LRCUM^ORCHTAB4 Q ; cum
105 D RR^LR7OR1(+ORVP,,BEG,END)
106 S SUB="CH" D LABS^ORCHTAB4,BLANK^ORCHTAB ; MI,AP,BB ??
107 S ORTITLE="Lab Tests" ;,ORACTNS="ORC LAB ACTIONS"
108 S ORCAPTN("ITEM")="Test Result Units Range"
109 S ORCAPTN("DATA")="Collected Accession Sts",ORCAPTN("MORE")=""
110 S ORCHANGE="ORCHANGE LAB LIST",ORMENU="ORCHART LABS MENU"
111 K ^TMP("LRRR",$J)
112 Q
113 ;
114XRAYS ; -- radiology
115 N BEG,END,MAX,ORI,ORX
116 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT XRAYS"),DEFCXT=1
117 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),MAX=$P(CONTEXT,";",5)
118 S ORX=$L($T(EN1^RAO7PC1),",") D EN1^RAO7PC1(+ORVP,BEG,END,MAX):ORX=4
119 D EN1^RAO7PC1(+ORVP,BEG,END,MAX,1):ORX>4 ;incl cancelled exams
120 S ORI=0 F S ORI=$O(^TMP($J,"RAE1",+ORVP,ORI)) Q:ORI'>0 S ORX=$G(^(ORI)) D XRAY^ORCHTAB4
121 S ORCAPTN("ITEM")="Procedure",ORCAPTN("DATA")="Exam Date Case Report Sts",ORCAPTN("MORE")=""
122 S ORACTNS="ORC XRAY ACTIONS",ORCHANGE="ORCHANGE XRAYS",ORRM=81
123 S ORTITLE="Imaging Procedures",ORMENU="ORCHART XRAYS MENU"
124 K ^TMP($J,"RAE1")
125 Q
126 ;
127CONSULTS ; -- consults
128 N BEG,END,STS,SERV,ORI,ORX
129 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT CONSULTS"),DEFCXT=1
130 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),STS=$P(CONTEXT,";",3),SERV=$P(CONTEXT,";",4)
131 S ORTITLE=$S($L(STS,",")>1:"Selected",STS:$$LOWER^VALM1($P(^ORD(100.01,+STS,0),U)),1:"All")_" "_$S('SERV:"",$L($G(^GMR(123.5,+SERV,.1))):^(.1)_" ",1:$P($G(^GMR(123.5,+SERV,0)),U)_" ")_"Consults"
132 D OER^GMRCSLM1(+ORVP,SERV,BEG,END,STS)
133 S ORI=0 F S ORI=$O(^TMP("GMRCR",$J,"CS",ORI)) Q:ORI'>0 S ORX=$G(^(ORI,0)) Q:$E(ORX)="<" D CSLT^ORCHTAB4
134 S ORCAPTN("ITEM")="Consult/Procedure",ORCAPTN("DATA")="Requested No. Status",ORCAPTN("MORE")=""
135 S ORACTNS="ORC CONSULT ACTIONS",ORCHANGE="ORCHANGE CONSULTS",ORRM=81
136 S ORMENU="ORCHART CONSULTS MENU"
137 K ^TMP("GMRCR",$J)
138 Q
139 ;
140REPORTS ; -- patient profiles
141 N X,BEG,END,MAX D RPT^ORCHTAB4
142 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT REPORTS"),DEFCXT=1 S X="Radiology"
143 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),MAX=$P(CONTEXT,";",5)
144 S X="Imaging ("_$$DATE^ORCHTAB(BEG)_" to "_$$DATE^ORCHTAB(END)_$S(MAX:", limit "_MAX,1:"")_")"
145 D BLANK^ORCHTAB,SUBHDR^ORCHTAB(X),XRAYS
146 I $L($T(EN^MCARPS2)) D BLANK^ORCHTAB,SUBHDR^ORCHTAB("Summary of Patient Procedures"),MED^ORCHTAB5
147 S ORCAPTN("ITEM")="Report",ORCAPTN("DATA")="Date Case Status",ORCAPTN("MORE")=""
148 S ORACTNS="ORC REPORT ACTIONS",ORMENU="ORCHART REPORTS MENU",ORRM=81
149 S ORCHANGE="ORCHANGE REPORTS",ORTITLE="Reports"
150 Q
Note: See TracBrowser for help on using the repository browser.