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

ORCHTAB1.m

Go to the documentation of this file.
ORCHTAB1 ;SLC/MKB-Build Chart-tabs cont ;6/14/02  12:49
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**2,27,58,72,141,189**;Dec 17, 1997
EN ; -- rebuild ORTAB listing
 Q:'$L($T(@ORTAB))  G @ORTAB
 Q
 ;
DT(X) ; -- Returns FM date for X
 N Y,%DT S %DT="T",Y="" D:X'="" ^%DT
 Q Y
 ;
COVER ; -- cover sheet
 N LBL,X
 F LBL="GMRA","CWAD","GMRV","IMM","SC" D @(LBL_"^ORCHTAB2"),BLANK^ORCHTAB
 S ORMENU="ORCHART COVER MENU",DEFCXT=1
 S ORTITLE="Cover Sheet",ORACTNS="ORC COVER ACTIONS",ORRM=81
 S ORCAPTN("ITEM")="Item",ORCAPTN("DATA")="Entered",ORCAPTN("MORE")=""
 Q
 ;
NOTES ; -- progress notes
 N BEG,END,STS,AUTHOR,ORY,ORI,ORX,OCCLIM,SUBJ
 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
 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)
 D CONTEXT^TIUSRVLO(.ORY,3,STS,+ORVP,BEG,END,AUTHOR,OCCLIM) S ORI=0
 I $L($G(ORY)) F  S ORI=$O(@ORY@(ORI)) Q:ORI'>0  S ORX=@ORY@(ORI) D NOTE^ORCHTAB2
 S ORTITLE=$S(STS=2:"Unsigned",STS=3:"Uncosigned",1:"Signed")_" Notes"_$S(AUTHOR:" by "_$$LNAMEF^ORCHTAB(AUTHOR),1:"")
 S ORCAPTN("ITEM")="Title",ORCAPTN("DATA")="Written         Author      SigSt",ORCAPTN("MORE")=""
 S ORACTNS="ORC TIU ACTIONS",ORCHANGE="ORCHANGE NOTES",ORRM=81
 S ORMENU="ORCHART NOTES MENU" K @ORY
 Q
 ;
SUMMRIES ; -- discharge summary
 N BEG,END,STS,AUTHOR,ORY,ORI,ORX
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT SUMMRIES"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),STS=$P(CONTEXT,";",3),AUTHOR=$P(CONTEXT,";",4)
 D CONTEXT^TIUSRVLO(.ORY,244,STS,+ORVP,BEG,END,AUTHOR) S ORI=0
 I $L($G(ORY)) F  S ORI=$O(@ORY@(ORI)) Q:ORI'>0  S ORX=@ORY@(ORI) D SUMM^ORCHTAB2
 S ORCAPTN("ITEM")="Title",ORCAPTN("DATA")="Ref Date     Author         SigSt",ORCAPTN("MORE")="Admitted  Discharged             "
 S ORACTNS="ORC TIU ACTIONS",ORMENU="ORCHART SUMMARIES MENU",ORCHANGE="ORCHANGE NOTES",ORRM=114
 S ORTITLE=$S(STS=2:"Unsigned",STS=3:"Uncosigned",1:"Signed")_" D/C Summaries"_$S(AUTHOR:" by "_$$LNAMEF^ORCHTAB(AUTHOR),1:"") K @ORY
 Q
 ;
PROBLEMS ; -- problem list
 N COMM,ST,ORY,ORI,ORX
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT PROBLEMS"),DEFCXT=1
 S ST=$P(CONTEXT,";",3),COMM=$P(CONTEXT,";",4) ;,PROV=$P(CONTEXT,";",5)
 D LIST^GMPLUTL2(.ORY,+ORVP,ST,COMM)
 S ORI=0 F  S ORI=$O(ORY(ORI)) Q:ORI'>0  S ORX=ORY(ORI) D PROB^ORCHTAB2
 S ORCAPTN("ITEM")="Problem",ORCAPTN("DATA")="Onset     Updated   Status",ORCAPTN("MORE")=""
 S ORTITLE=$S(ST="A":"Active",ST="I":"Inactive",1:"All")_" Problems"
 S ORACTNS="ORC PROBLEM ACTIONS",ORCHANGE="ORCHANGE PROBLEMS",ORRM=81
 S ORMENU="ORCHART PROBLEMS MENU"
 Q
 ;
NEW ; -- new orders in ORNEW()
 N OREVENT S CONTEXT=";;19;ALL;L",DEFCXT=1 G ORDERS
DELAY ; -- delayed orders [from ORCACT3]
 N OREVENT S CONTEXT=";;24;ALL;L",DEFCXT=1 G ORDERS
 ;
ORDERS ; -- orders
 N DGRP,STS,BEG,END,ORLIST,ORIFN,ORI,MULT,ORYD,FRMT,DELAY,EVT
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT ORDERS"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2))
 S DGRP=$P(CONTEXT,";",4),FRMT=$P(CONTEXT,";",5),EVT=$P(CONTEXT,";",8)
 S:'$L(DGRP) DGRP="ALL" S DGRP=+$O(^ORD(100.98,"B",DGRP,0))
 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)
 S MULT=$S("^1^6^8^9^10^11^13^14^20^22^"[(U_STS_U):1,1:0)
 S ORTITLE=$$STATUS(STS,EVT)_$S(DGRP>1:" "_$P($G(^ORD(100.98,+DGRP,0)),U,2),1:"")_" Orders",ORRM=114
 S ORCAPTN("ITEM")="Item Ordered",ORCAPTN("MORE")="NRS    CLK    Chart             "
 S:FRMT="S" ORCAPTN("DATA")="Start Date      Order Status"
 S:FRMT'="S" ORCAPTN("DATA")="Provider    Start      Stop  Sts"
 D EN^ORQ1(ORVP,DGRP,+STS,,BEG,END,,MULT,,1,EVT),ORYD^ORDD100 ;Get list
 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
 S DELAY=$S("^15^16^17^24^25^26^"[(U_STS_U):1,$G(OREVENT):1,1:0)
 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"
 I ORTAB'="NEW" S ORCHANGE="ORCHANGE ORDERS "_$S(FRMT="L":"LONG",1:"SHORT")
 K ^TMP("ORR",$J,ORLIST)
 Q
 ;
STATUS(X,Y) ; -- Return name of context/status number
 N Z I $G(Y) S Z=$$NAME^OREVNTX(Y),Z=$$LOWER^VALM1(Z) Q Z  ;Event
 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"
 Q $P(Z,U,+X)
 ;
MEDS ; -- medications
 N BEG,END,INPT,ORI,ORJ,ORX
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT MEDS"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2))
 S INPT=$P(CONTEXT,";",3) S:'$L(INPT) INPT=$S($G(ORWARD):1,1:0)
 D OCL^PSOORRL(+ORVP,BEG,END),SORT^ORCHTAB3(INPT)
 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
 S ORCAPTN("ITEM")="Medication",ORCAPTN("MORE")="",ORRM=81
 S:INPT ORCAPTN("DATA")="Start     Stop      Status"
 S:'INPT ORCAPTN("DATA")="Requestor   Expires   Status"
 S ORACTNS="ORC "_$S(INPT:"IN",1:"OUT")_"PT MED ACTIONS",ORMENU="ORCHART MEDS MENU"
 S ORCHANGE="ORCHANGE MEDS "_$S(INPT:"INPT",1:"OUTPT")
 S ORTITLE=$S($L(BEG)!$L(END):"",1:"Active ")_$S(INPT:"In",1:"Out")_"patient Medications"
 K ^TMP("PS",$J),^TMP("ORPS",$J)
 Q
 ;
LABS ; -- laboratory
 N BEG,END,TYPE,SUB,X
 I '$L(CONTEXT) S CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT "_$S($G(ORWARD):"IN",1:"OUT")_"PT LABS"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),TYPE=$P(CONTEXT,";",3),ORRM=81
 I TYPE="C" D LRCUM^ORCHTAB4 Q  ; cum
 D RR^LR7OR1(+ORVP,,BEG,END)
 S SUB="CH" D LABS^ORCHTAB4,BLANK^ORCHTAB ; MI,AP,BB ??
 S ORTITLE="Lab Tests" ;,ORACTNS="ORC LAB ACTIONS"
 S ORCAPTN("ITEM")="Test       Result    Units      Range"
 S ORCAPTN("DATA")="Collected       Accession     Sts",ORCAPTN("MORE")=""
 S ORCHANGE="ORCHANGE LAB LIST",ORMENU="ORCHART LABS MENU"
 K ^TMP("LRRR",$J)
 Q
 ;
XRAYS ; -- radiology
 N BEG,END,MAX,ORI,ORX
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT XRAYS"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),MAX=$P(CONTEXT,";",5)
 S ORX=$L($T(EN1^RAO7PC1),",") D EN1^RAO7PC1(+ORVP,BEG,END,MAX):ORX=4
 D EN1^RAO7PC1(+ORVP,BEG,END,MAX,1):ORX>4 ;incl cancelled exams
 S ORI=0 F  S ORI=$O(^TMP($J,"RAE1",+ORVP,ORI)) Q:ORI'>0  S ORX=$G(^(ORI)) D XRAY^ORCHTAB4
 S ORCAPTN("ITEM")="Procedure",ORCAPTN("DATA")="Exam Date       Case  Report Sts",ORCAPTN("MORE")=""
 S ORACTNS="ORC XRAY ACTIONS",ORCHANGE="ORCHANGE XRAYS",ORRM=81
 S ORTITLE="Imaging Procedures",ORMENU="ORCHART XRAYS MENU"
 K ^TMP($J,"RAE1")
 Q
 ;
CONSULTS ; -- consults
 N BEG,END,STS,SERV,ORI,ORX
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT CONSULTS"),DEFCXT=1
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),STS=$P(CONTEXT,";",3),SERV=$P(CONTEXT,";",4)
 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"
 D OER^GMRCSLM1(+ORVP,SERV,BEG,END,STS)
 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
 S ORCAPTN("ITEM")="Consult/Procedure",ORCAPTN("DATA")="Requested    No.  Status",ORCAPTN("MORE")=""
 S ORACTNS="ORC CONSULT ACTIONS",ORCHANGE="ORCHANGE CONSULTS",ORRM=81
 S ORMENU="ORCHART CONSULTS MENU"
 K ^TMP("GMRCR",$J)
 Q
 ;
REPORTS ; -- patient profiles
 N X,BEG,END,MAX D RPT^ORCHTAB4
 S:'$L(CONTEXT) CONTEXT=$$GET^XPAR("ALL","ORCH CONTEXT REPORTS"),DEFCXT=1 S X="Radiology"
 S BEG=$$DT($P(CONTEXT,";")),END=$$DT($P(CONTEXT,";",2)),MAX=$P(CONTEXT,";",5)
 S X="Imaging ("_$$DATE^ORCHTAB(BEG)_" to "_$$DATE^ORCHTAB(END)_$S(MAX:", limit "_MAX,1:"")_")"
 D BLANK^ORCHTAB,SUBHDR^ORCHTAB(X),XRAYS
 I $L($T(EN^MCARPS2)) D BLANK^ORCHTAB,SUBHDR^ORCHTAB("Summary of Patient Procedures"),MED^ORCHTAB5
 S ORCAPTN("ITEM")="Report",ORCAPTN("DATA")="Date            Case  Status",ORCAPTN("MORE")=""
 S ORACTNS="ORC REPORT ACTIONS",ORMENU="ORCHART REPORTS MENU",ORRM=81
 S ORCHANGE="ORCHANGE REPORTS",ORTITLE="Reports"
 Q