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

DGSDU.m

Go to the documentation of this file.
  1. DGSDU ;ALB/TMP - ACRP API UTILITIES ; 12/8/97 15:09
  1. ;;5.3;Registration;**151**;Aug 13, 1993
  1. ;;
  1. SCAN(DGINDX,DGVAL,DGFILTER,DGCBK,DGCLOSE,DGQUERY,DGDIR) ; Scan encounters
  1. ; *** NOTE *** When using this call, the variable passed as DGQUERY
  1. ; must be newed or killed in the callling program
  1. ; DGINDX = index name property of the query object
  1. ; DGVAL = array of data elements for start/end of search
  1. ; DGVAL("DFN") = patient DFN
  1. ; DGVAL("BDT") = begin date
  1. ; DGVAL("EDT") = end date
  1. ; DGVAL("VIS") = encounter file ien
  1. ; DGFILTER = the executable code to use to screen entries
  1. ; DGCBK = the executable scan callback code to create the result set
  1. ; DGCLOSE = Flag that says whether or not to close the QUERY object
  1. ; 1 = Perform close 0 or null = Do not close object
  1. ; DGQUERY = the # of the current query, if not a new query. If passed by
  1. ; reference and query closed, this variable will be nulled
  1. ; DGDIR = the direction of the scan (optional)
  1. ; null, undefined or FORWARD : Scan forwards
  1. ; BACKWARD : Scan backwards
  1. ;
  1. N QUERY
  1. S QUERY=$G(DGQUERY)
  1. I '$G(QUERY) D
  1. .D OPEN^SDQ(.DGQUERY) Q:'$G(DGQUERY)
  1. .D INDEX^SDQ(.DGQUERY,DGINDX,"SET")
  1. .I $G(DGFILTER)'="" D FILTER^SDQ(.DGQUERY,DGFILTER,"SET")
  1. .D SCANCB^SDQ(.DGQUERY,DGCBK,"SET")
  1. I $G(QUERY) D ACTIVE^SDQ(.DGQUERY,"FALSE","SET")
  1. D SETINDX(.DGQUERY,DGINDX)
  1. D ACTIVE^SDQ(.DGQUERY,"TRUE","SET")
  1. S:$G(DGDIR)="" DGDIR="FORWARD"
  1. D SCAN^SDQ(.DGQUERY,DGDIR)
  1. I $G(DGCLOSE) D CLOSE(.DGQUERY)
  1. SCANQ Q
  1. ;
  1. CLOSE(DGQUERY) ; Close the query
  1. G:'$G(DGQUERY) CLOSEQ
  1. D CLOSE^SDQ(.DGQUERY)
  1. CLOSEQ Q
  1. ;
  1. SETINDX(DGQUERY,DGINDX) ;
  1. I DGINDX="PATIENT/DATE" D PAT,DATE
  1. I DGINDX="DATE/TIME" D DATE
  1. I DGINDX="PATIENT" D PAT
  1. I DGINDX="VISIT" D VIS
  1. Q
  1. ;
  1. PAT ; Verify patient
  1. D PAT^SDQ(.DGQUERY,$G(DGVAL("DFN")),"SET")
  1. Q
  1. ;
  1. DATE ; Verify date range
  1. D DATE^SDQ(.DGQUERY,$G(DGVAL("BDT")),$G(DGVAL("EDT")),"SET")
  1. Q
  1. ;
  1. VIS ; Verify visit
  1. D VISIT^SDQ(.DGQUERY,$G(DGVAL("VIS")),"SET")
  1. Q
  1. ;
  1. SCE(DGOE,PC,NODE,ZXERR) ; Returns the specific piece or entire node of the enctr
  1. ; NODE = the node to return ... if undefined, the 0-node is assumed
  1. ; If PC is null or undefined, the whole node is returned, otherwise
  1. ; just the PC-piece is returned
  1. ; DGERR = the name of the array where errors should be passed back in
  1. ; (pass in quotes I.E.: "DGERR"). If no name passed, errors are
  1. ; not returned
  1. N DGX
  1. S:$G(NODE)="" NODE=0
  1. D GETGEN^SDOE(DGOE,"DGX",$G(ZXERR))
  1. I $G(ZXERR)="" K ^TMP("DIERR",$J)
  1. S DGX=$S($G(PC):$P($G(DGX(NODE)),U,+PC),1:$G(DGX(NODE)))
  1. Q DGX
  1. ;