SDOEQ ;ALB/MJK - Encounter Query Object Methods ;8/12/96
;;5.3;Scheduling;**131,132**;Aug 13, 1993
;
;
OE0(SDOE) ; -- get only supported 0th node fields
N X
S X=$G(^SCE(SDOE,0))
; -- null EXTENDED REFERENCE field (piece 9)
IF X]"" S $P(X,"^",9)=""
Q X
;
SDOE(SDOE,SDFIL,SDCB,SDSTOP) ; -- do filter and callback
N Y,Y0,SDOE0
S SDOE0=$$OE0(.SDOE)
;
; -- exit if null record
IF SDOE0="" G SDOEXQ
;
; -- execute filter
S Y=SDOE,Y0=SDOE0
X:SDFIL]"" SDFIL
;
; -- execute callback if passes filter
S Y=SDOE,Y0=SDOE0
IF $T X SDCB
SDOEXQ Q
;
SCAN(SDQ,SDIR,SDERR) ; -- full scan of all needed records
N SDCB,SDSTOP,SDIDX,SDFIL,X,SDQDIR
S SDSTOP=0
S X=$G(SDIR),SDQDIR=$S(X="":"FORWARD",1:X)
D INDEX^SDQ(.SDQ,.SDIDX,"GET",$G(SDERR))
IF '$$ERRCHK^SDQUT($G(SDERR)) D SCANCB^SDQ(.SDQ,.SDCB,"GET",$G(SDERR))
IF '$$ERRCHK^SDQUT($G(SDERR)) D FILTER^SDQ(.SDQ,.SDFIL,"GET",$G(SDERR))
IF $$ERRCHK^SDQUT($G(SDERR)) G SCANQ
;
IF SDIDX="PATIENT/DATE" D SCANPDT
IF SDIDX="VISIT" D SCANVST
IF SDIDX="PATIENT" D SCANPAT
IF SDIDX="DATE/TIME" D SCANDT
;
SCANQ Q
;
SCANPDT ; -- scan by patient and date
N SDFN,SDBEG,SDEND,SDDT,SDOE
D PAT^SDQ(.SDQ,.SDFN,"GET",$G(SDERR))
IF '$$ERRCHK^SDQUT($G(SDERR)) D DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$G(SDERR))
IF $$ERRCHK^SDQUT($G(SDERR)) G SCANPDTQ
;
IF SDQDIR="FORWARD" D
. S SDDT=SDBEG-.000001
. F S SDDT=$O(^SCE("ADFN",SDFN,SDDT)) Q:'SDDT!(SDDT>SDEND) D Q:SDSTOP
. . S SDOE=""
. . F S SDOE=$O(^SCE("ADFN",SDFN,SDDT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
. ;
ELSE D
. S SDDT=SDEND+.000001
. F S SDDT=$O(^SCE("ADFN",SDFN,SDDT),-1) Q:'SDDT!(SDDT<SDBEG) D Q:SDSTOP
. . S SDOE=""
. . F S SDOE=$O(^SCE("ADFN",SDFN,SDDT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
;
SCANPDTQ Q
;
SCANVST ; -- scan by visit
N SDVSIT,SDOE
S SDSTOP=0
D VISIT^SDQ(.SDQ,.SDVSIT,"GET",$G(SDERR))
IF $$ERRCHK^SDQUT($G(SDERR)) G SCANVSTQ
;
IF SDQDIR="FORWARD" D
. S SDOE=""
. F S SDOE=$O(^SCE("AVSIT",SDVSIT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
. ;
ELSE D
. S SDOE=""
. F S SDOE=$O(^SCE("AVSIT",SDVSIT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
;
SCANVSTQ Q
;
SCANDT ; -- date only scan
N SDDT,SDBEG,SDEND,SDOE
D DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$G(SDERR))
IF $$ERRCHK^SDQUT($G(SDERR)) G SCANDTQ
;
IF SDQDIR="FORWARD" D
. S SDDT=SDBEG-.000001
. F S SDDT=$O(^SCE("B",SDDT)) Q:SDDT=""!(SDDT>SDEND) D Q:SDSTOP
. . S SDOE=""
. . F S SDOE=$O(^SCE("B",SDDT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
;
ELSE D
. S SDDT=SDEND+.000001
. F S SDDT=$O(^SCE("B",SDDT),-1) Q:SDDT=""!(SDDT<SDBEG) D Q:SDSTOP
. . S SDOE=""
. . F S SDOE=$O(^SCE("B",SDDT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
;
SCANDTQ Q
;
SCANPAT ; -- patient only scan
N SDFN,SDOE
S SDSTOP=0
D PAT^SDQ(.SDQ,.SDFN,"GET",$G(SDERR))
IF $$ERRCHK^SDQUT($G(SDERR)) G SCANPATQ
;
IF SDQDIR="FORWARD" D
. S SDOE=""
. F S SDOE=$O(^SCE("C",SDFN,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
. ;
ELSE D
. S SDOE=""
. F S SDOE=$O(^SCE("C",SDFN,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
;
SCANPATQ Q
;
PAT(SDQ,SDFN,SDACT,SDERR) ; -- SDQ PATIENT
; API ID: 81
;
;
PATG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G PATQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G PATQ
IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G PATQ
IF SDACT="SET",'$$PAT^SDQVAL(.SDFN,$G(SDERR)) G PATQ
;
IF SDACT="SET" S @SDQUERY@(SDQ,"MASTER VALUE")=SDFN
IF SDACT="GET" S SDFN=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
PATQ Q
;
VISIT(SDQ,SDVST,SDACT,SDERR) ; -- SDQ VISIT
; API ID: 84
;
;
VISITG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G VISITQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G VISITQ
IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G VISITQ
IF SDACT="SET",'$$VALVST^PXAPIOE(.SDVST,$G(SDERR)) G VISITQ
;
IF SDACT="SET" S @SDQUERY@(SDQ,"MASTER VALUE")=SDVST
IF SDACT="GET" S SDVST=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
;
VISITQ Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDOEQ 4269 printed Dec 13, 2024@02:59:07 Page 2
SDOEQ ;ALB/MJK - Encounter Query Object Methods ;8/12/96
+1 ;;5.3;Scheduling;**131,132**;Aug 13, 1993
+2 ;
+3 ;
OE0(SDOE) ; -- get only supported 0th node fields
+1 NEW X
+2 SET X=$GET(^SCE(SDOE,0))
+3 ; -- null EXTENDED REFERENCE field (piece 9)
+4 IF X]""
SET $PIECE(X,"^",9)=""
+5 QUIT X
+6 ;
SDOE(SDOE,SDFIL,SDCB,SDSTOP) ; -- do filter and callback
+1 NEW Y,Y0,SDOE0
+2 SET SDOE0=$$OE0(.SDOE)
+3 ;
+4 ; -- exit if null record
+5 IF SDOE0=""
GOTO SDOEXQ
+6 ;
+7 ; -- execute filter
+8 SET Y=SDOE
SET Y0=SDOE0
+9 if SDFIL]""
XECUTE SDFIL
+10 ;
+11 ; -- execute callback if passes filter
+12 SET Y=SDOE
SET Y0=SDOE0
+13 IF $TEST
XECUTE SDCB
SDOEXQ QUIT
+1 ;
SCAN(SDQ,SDIR,SDERR) ; -- full scan of all needed records
+1 NEW SDCB,SDSTOP,SDIDX,SDFIL,X,SDQDIR
+2 SET SDSTOP=0
+3 SET X=$GET(SDIR)
SET SDQDIR=$SELECT(X="":"FORWARD",1:X)
+4 DO INDEX^SDQ(.SDQ,.SDIDX,"GET",$GET(SDERR))
+5 IF '$$ERRCHK^SDQUT($GET(SDERR))
DO SCANCB^SDQ(.SDQ,.SDCB,"GET",$GET(SDERR))
+6 IF '$$ERRCHK^SDQUT($GET(SDERR))
DO FILTER^SDQ(.SDQ,.SDFIL,"GET",$GET(SDERR))
+7 IF $$ERRCHK^SDQUT($GET(SDERR))
GOTO SCANQ
+8 ;
+9 IF SDIDX="PATIENT/DATE"
DO SCANPDT
+10 IF SDIDX="VISIT"
DO SCANVST
+11 IF SDIDX="PATIENT"
DO SCANPAT
+12 IF SDIDX="DATE/TIME"
DO SCANDT
+13 ;
SCANQ QUIT
+1 ;
SCANPDT ; -- scan by patient and date
+1 NEW SDFN,SDBEG,SDEND,SDDT,SDOE
+2 DO PAT^SDQ(.SDQ,.SDFN,"GET",$GET(SDERR))
+3 IF '$$ERRCHK^SDQUT($GET(SDERR))
DO DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$GET(SDERR))
+4 IF $$ERRCHK^SDQUT($GET(SDERR))
GOTO SCANPDTQ
+5 ;
+6 IF SDQDIR="FORWARD"
Begin DoDot:1
+7 SET SDDT=SDBEG-.000001
+8 FOR
SET SDDT=$ORDER(^SCE("ADFN",SDFN,SDDT))
if 'SDDT!(SDDT>SDEND)
QUIT
Begin DoDot:2
+9 SET SDOE=""
+10 FOR
SET SDOE=$ORDER(^SCE("ADFN",SDFN,SDDT,SDOE))
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:2
if SDSTOP
QUIT
+11 ;
End DoDot:1
+12 IF '$TEST
Begin DoDot:1
+13 SET SDDT=SDEND+.000001
+14 FOR
SET SDDT=$ORDER(^SCE("ADFN",SDFN,SDDT),-1)
if 'SDDT!(SDDT<SDBEG)
QUIT
Begin DoDot:2
+15 SET SDOE=""
+16 FOR
SET SDOE=$ORDER(^SCE("ADFN",SDFN,SDDT,SDOE),-1)
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:2
if SDSTOP
QUIT
End DoDot:1
+17 ;
SCANPDTQ QUIT
+1 ;
SCANVST ; -- scan by visit
+1 NEW SDVSIT,SDOE
+2 SET SDSTOP=0
+3 DO VISIT^SDQ(.SDQ,.SDVSIT,"GET",$GET(SDERR))
+4 IF $$ERRCHK^SDQUT($GET(SDERR))
GOTO SCANVSTQ
+5 ;
+6 IF SDQDIR="FORWARD"
Begin DoDot:1
+7 SET SDOE=""
+8 FOR
SET SDOE=$ORDER(^SCE("AVSIT",SDVSIT,SDOE))
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
+9 ;
End DoDot:1
+10 IF '$TEST
Begin DoDot:1
+11 SET SDOE=""
+12 FOR
SET SDOE=$ORDER(^SCE("AVSIT",SDVSIT,SDOE),-1)
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:1
+13 ;
SCANVSTQ QUIT
+1 ;
SCANDT ; -- date only scan
+1 NEW SDDT,SDBEG,SDEND,SDOE
+2 DO DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$GET(SDERR))
+3 IF $$ERRCHK^SDQUT($GET(SDERR))
GOTO SCANDTQ
+4 ;
+5 IF SDQDIR="FORWARD"
Begin DoDot:1
+6 SET SDDT=SDBEG-.000001
+7 FOR
SET SDDT=$ORDER(^SCE("B",SDDT))
if SDDT=""!(SDDT>SDEND)
QUIT
Begin DoDot:2
+8 SET SDOE=""
+9 FOR
SET SDOE=$ORDER(^SCE("B",SDDT,SDOE))
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:2
if SDSTOP
QUIT
End DoDot:1
+10 ;
+11 IF '$TEST
Begin DoDot:1
+12 SET SDDT=SDEND+.000001
+13 FOR
SET SDDT=$ORDER(^SCE("B",SDDT),-1)
if SDDT=""!(SDDT<SDBEG)
QUIT
Begin DoDot:2
+14 SET SDOE=""
+15 FOR
SET SDOE=$ORDER(^SCE("B",SDDT,SDOE),-1)
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:2
if SDSTOP
QUIT
End DoDot:1
+16 ;
SCANDTQ QUIT
+1 ;
SCANPAT ; -- patient only scan
+1 NEW SDFN,SDOE
+2 SET SDSTOP=0
+3 DO PAT^SDQ(.SDQ,.SDFN,"GET",$GET(SDERR))
+4 IF $$ERRCHK^SDQUT($GET(SDERR))
GOTO SCANPATQ
+5 ;
+6 IF SDQDIR="FORWARD"
Begin DoDot:1
+7 SET SDOE=""
+8 FOR
SET SDOE=$ORDER(^SCE("C",SDFN,SDOE))
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
+9 ;
End DoDot:1
+10 IF '$TEST
Begin DoDot:1
+11 SET SDOE=""
+12 FOR
SET SDOE=$ORDER(^SCE("C",SDFN,SDOE),-1)
if SDOE=""
QUIT
DO SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP)
if SDSTOP
QUIT
End DoDot:1
+13 ;
SCANPATQ QUIT
+1 ;
PAT(SDQ,SDFN,SDACT,SDERR) ; -- SDQ PATIENT
+1 ; API ID: 81
+2 ;
+3 ;
PATG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO PATQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO PATQ
+4 IF SDACT="SET"
IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO PATQ
+5 IF SDACT="SET"
IF '$$PAT^SDQVAL(.SDFN,$GET(SDERR))
GOTO PATQ
+6 ;
+7 IF SDACT="SET"
SET @SDQUERY@(SDQ,"MASTER VALUE")=SDFN
+8 IF SDACT="GET"
SET SDFN=$GET(@SDQUERY@(SDQ,"MASTER VALUE"))
PATQ QUIT
+1 ;
VISIT(SDQ,SDVST,SDACT,SDERR) ; -- SDQ VISIT
+1 ; API ID: 84
+2 ;
+3 ;
VISITG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO VISITQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO VISITQ
+4 IF SDACT="SET"
IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO VISITQ
+5 IF SDACT="SET"
IF '$$VALVST^PXAPIOE(.SDVST,$GET(SDERR))
GOTO VISITQ
+6 ;
+7 IF SDACT="SET"
SET @SDQUERY@(SDQ,"MASTER VALUE")=SDVST
+8 IF SDACT="GET"
SET SDVST=$GET(@SDQUERY@(SDQ,"MASTER VALUE"))
+9 ;
VISITQ QUIT
+1 ;