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

ORCDLR2.m

Go to the documentation of this file.
  1. ORCDLR2 ;SLC/MKB - Silent utilities for LR dialogs ; 11/4/2007
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243,303,317**;Dec 17, 1997;Build 2
  1. ;
  1. ;DJE/VM *317 ORLR changed to ORLRGUI
  1. GUI(ORY,ORL,ORDERS) ; -- ck list of ORDERS for labs w/invalid coll times
  1. N ORI,ORIFN,ORCNT,RES,I,N,DAD,X
  1. K ^TMP($J,"ORLRGUI") S ORCNT=0
  1. S ORI="" F S ORI=$O(ORDERS(ORI)) Q:ORI="" D
  1. . Q:+$P(ORDERS(ORI),";",2)>1 ;only ck NW order actions
  1. . S ORIFN=+ORDERS(ORI) Q:'$$LC(ORIFN) ;only ck Lab, LC/I orders
  1. . K RES D KIDS(.RES,$G(ORL),ORIFN)
  1. . S I=0 F S I=$O(RES(I)) Q:I<1 I $P(RES(I),U,2) K RES(I)
  1. . Q:'$O(RES(0)) ;no invalid times found
  1. . S ORCNT=ORCNT+1,^TMP($J,"ORLRGUI",ORCNT)=ORIFN
  1. . S I=0 F S I=$O(RES(I)) Q:I<1 S ^TMP($J,"ORLRGUI",ORCNT,I)=RES(I)
  1. S ORY(1)="~COUNT",ORY(2)="d"_ORCNT,N=2
  1. F DAD=1:1:ORCNT S ORIFN=$G(^TMP($J,"ORLRGUI",DAD)) D
  1. . S N=N+1,ORY(N)="~ORDER_"_DAD
  1. . S N=N+1,ORY(N)="t#"_ORIFN_" "_$G(^OR(100,ORIFN,8,1,.1,1,0)) ;1st line order text
  1. . S ORI=0 F S ORI=$O(^TMP($J,"ORLRGUI",DAD,ORI)) Q:ORI<1 S X=^(ORI) D
  1. .. S N=N+1,ORY(N)="i"_X
  1. Q
  1. ;
  1. KIDS(ORY,ORL,ORIFN,DATE,TYPE,SCH,DUR) ; -- get child times, validate LC/IC
  1. ; ORL = Hospital Location file #44 vptr
  1. ; ORIFN = Orders file #100 ien
  1. ; or
  1. ; DATE = Start date.time or "AM" or "NEXT"
  1. ; TYPE = LC or I
  1. ; SCH = Administration Schedule file #51.1 ien
  1. ; DUR = # or "X"_#
  1. ; Will quit if OREVENT exists <can't check delayed orders>
  1. ;
  1. ; Returns ORY(n) = child start.time ^ 1 or 0 ^ [error message]
  1. ;
  1. N OR0,VALIDT,ORTIME,ORIMTIME,ORDIV,X,Y,%DT,ORSTRT,ORI,ORN,OK
  1. S OR0=$G(^OR(100,+$G(ORIFN),0)) Q:$P(OR0,U,17) Q:$G(OREVENT) ;delayed orders
  1. I $G(ORIFN),'$L($G(DATE))!'$L($G(TYPE))!'$G(SCH)!'$L($G(DUR)) D ;get values
  1. . S DATE=$$VALUE^ORX8(ORIFN,"START")
  1. . S TYPE=$$VALUE^ORX8(ORIFN,"COLLECT")
  1. . S SCH=$$VALUE^ORX8(ORIFN,"SCHEDULE")
  1. . S DUR=$$VALUE^ORX8(ORIFN,"DAYS")
  1. Q:'$L($G(DATE)) Q:'$G(SCH) Q:"SPWC"[$G(TYPE) Q:'$L($G(DUR))
  1. S VALIDT="" D GETIMES^ORCDLR1
  1. D AM^ORCSAVE2:DATE="AM",NEXT^ORCSAVE2:DATE="NEXT" ; returns X
  1. S %DT="T" S:'$D(X) X=DATE D ^%DT I Y<1 Q
  1. D SCHEDULE(.ORSTRT,Y,SCH,DUR) Q:ORSTRT'>1 0 ; get all starts
  1. K ORY S ORY=ORSTRT
  1. S (ORI,ORN)=0 F S ORI=$O(ORSTRT(ORI)) Q:'ORI S OK="" D
  1. . I TYPE="LC" S OK=$$LABCOLL^ORCDLR1(ORI)
  1. . I TYPE="I" S OK=$$IMMCOLL^ORCDLR1(ORI)
  1. . S ORN=ORN+1,ORY(ORN)=ORI_U_OK
  1. Q
  1. ;
  1. SCHEDULE(ORY,PSJSD,SCH,ORDUR) ; Returns list of start time(s) from schedule
  1. ; PSJEEU - DBIA #2417
  1. ; PSS51P1 - DBIA #4546
  1. N I,X,ORSCH,PSJFD,PSJW,PSJNE,PSJPP,PSJX,PSJAT,PSJM,PSJTS,PSJY,PSJAX,PSJSCH,PSJOSD,PSJOFD,PSJC,NXT
  1. Q:'$G(PSJSD) S ORY=1,ORY(PSJSD)="",SCH=$G(SCH) ;1st occurrance
  1. S I="",X=SCH S:+SCH I=+SCH,X="" ;I=ien or X=name
  1. D ZERO^PSS51P1(I,X,"LR",,"ORLR") S ORSCH=+$O(^TMP($J,"ORLR",0)) ;ien
  1. S PSJX=$G(^TMP($J,"ORLR",ORSCH,.01))
  1. S PSJW=+$G(ORL),PSJNE="",PSJPP="LR" D ENSV^PSJEEU Q:'$L($G(PSJX))
  1. I $G(PSJTS)'="C",$G(PSJTS)'="D" Q ;not continuous or day-of-week
  1. S PSJSCH=PSJX
  1. S:ORDUR PSJFD=$$FMADD^XLFDT(PSJSD,+ORDUR,,-1)
  1. I 'ORDUR S X=+$E(ORDUR,2,9) D
  1. . I PSJM S PSJFD=$$FMADD^XLFDT(PSJSD,,,(PSJM*X)-1) ;X_#times
  1. . E D ;no freq in minutes --> day of week
  1. .. N DAYS,LOCMX,SCHMX
  1. .. S LOCMX=$$GET^XPAR("ALL^LOC.`"_+$G(ORL),"LR MAX DAYS CONTINUOUS",1,"Q")
  1. .. S SCHMX=$G(^TMP($J,"ORLR",ORSCH,2.5))
  1. .. S DAYS=$S('SCHMX:LOCMX,LOCMX<SCHMX:LOCMX,1:SCHMX)
  1. .. S PSJFD=$$FMADD^XLFDT(PSJSD,DAYS,,-1)
  1. D ENSPU^PSJEEU K ORY
  1. I ORDUR M ORY=PSJC Q
  1. S ORY=$S(PSJC<$E(ORDUR,2,9):PSJC,1:$E(ORDUR,2,9))
  1. S NXT=0 F I=1:1:ORY S NXT=$O(PSJC(NXT)) Q:'NXT S ORY(NXT)=PSJC(NXT)
  1. Q
  1. ;
  1. LC(IEN) ; -- Return 1 or 0, if order IEN is to Lab for LC or I
  1. N Y,X0,PKG S Y=0
  1. S X0=$G(^OR(100,+$G(IEN),0)),PKG=$$NMSP^ORCD(+$P(X0,U,14))
  1. I PKG="LR" D
  1. . N X S X=$$VALUE^ORX8(IEN,"COLLECT")
  1. . I X="LC"!(X="I") S Y=1
  1. Q Y