SDQ ;ALB/MJK - Query Object Methods ;8/12/96
;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
;
OPEN(SDQ,SDERR) ; -- SDQ OPEN [API ID: 79]
D PREP^SDQUT
;
; -- get query object instance and set up query class info
IF '$$CREATE(.SDQ,"SD STANDARD ENCOUNTER QUERY",$G(SDERR)) G OPENQ
;
; -- do query object instance kills and sets
K @SDQUERY@(SDQ)
S @SDQUERY@(SDQ)=""
F X="SCAN" M @SDQUERY@(SDQ,X)=^TMP("SDQUERY CLASS",$J,SDQ,X)
D STOP^SDQPROP(.SDQ)
;
; -- do open actions
N SDOPEN
S SDOPEN=$G(^TMP("SDQUERY CLASS",$J,SDQ,"OPEN"))
IF SDOPEN]"" X SDOPEN
OPENQ Q
;
CLOSE(SDQ,SDERR) ; -- SDQ CLOSE [API ID: 80]
D PREP^SDQUT
;
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G CLOSEQ
;
; -- do close actions
N SDCLOSE
S SDCLOSE=$G(^TMP("SDQUERY CLASS",$J,SDQ,"CLOSE"))
IF SDCLOSE]"" X SDCLOSE
;
; -- do query object instance kills
K @SDQUERY@(SDQ)
;
; -- do query class kills
IF '$$DESTROY(.SDQ) G CLOSEQ
S SDQ=""
CLOSEQ Q
;
CREATE(SDQ,SDQNAME,SDERR) ; -- query class level method for CREATE
N SDCLS,SDCLS0,SDOK,SDSTORE
S SDCLS=+$O(^SD(409.64,"B",SDQNAME,0))
IF SDCLS D
. S SDCLS0=$G(^SD(409.64,SDCLS,0))
. S SDSTORE=$S($P(SDCLS0,U,4):$P(SDCLS0,U,4),1:5000)
. IF $G(SDQUERY)="" S SDQUERY="SDQDATA"
. D STORE(.SDQUERY,SDSTORE)
. IF '$O(@SDQUERY@(0)) D KILL
. ;
. ; -- set query id
. S (SDQ,@SDQUERY)=$G(@SDQUERY)+1
. ; -- set up tmp class info
. K ^TMP("SDQUERY CLASS",$J,SDQ)
. M ^TMP("SDQUERY CLASS",$J,SDQ)=^SD(409.64,SDCLS)
. S ^TMP("SDQUERY CLASS",$J,SDQ)=SDCLS
. S ^TMP("SDQUERY CLASS",$J,SDQ,"GL")=$G(^DIC(+$P(SDCLS0,"^",2),0,"GL"))
. ; -- subscript level of files root ; ex:^SCE = 0 ; ex:^SD(404.42, = 1
. S ^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS")=+$P(SDCLS0,"^",3)
. ;
. S SDOK=1
ELSE D
. ; -- build error msg
. N SDIN,SDOUT
. S SDIN("CLASS")=SDQNAME
. S SDOUT("CLASS")=SDQNAME
. D BLD^SDQVAL(4096400.001,.SDIN,.SDOUT,$G(SDERR))
. S SDOK=0
;
Q SDOK
;
STORE(SDQUERY,SDSTORE) ; -- decide whether to use a local or global
N SDOLD
IF $S<SDSTORE,SDQUERY'["^TMP" D
. S SDOLD=SDQUERY
. S SDQUERY=$NA(^TMP("SDQDATA",$J))
. K @SDQUERY
. M @SDQUERY=@SDOLD
. K @SDOLD
Q
;
DESTROY(SDQ) ; -- query class level method for DESTROY
K ^TMP("SDQUERY CLASS",$J,SDQ)
IF '$O(@SDQUERY@(0)) D KILL K SDQUERY
Q 1
;
KILL ; -- kill class and ien list globals
K ^TMP("SDQUERY CLASS",$J)
K ^TMP("SDQUERY LIST",$J)
K @SDQUERY
Q
;
;
PAT(SDQ,SDFN,SDACT,SDERR) ; -- SDQ PATIENT [API ID: 81]
D PREP^SDQUT
G PATG^SDOEQ
;
GETPAT(SDQ,SDERR) ; -- get patient property [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDFN
D PAT^SDOEQ(.SDQ,.SDFN,"GET",$G(SDERR))
Q $G(SDFN)
;
DATE(SDQ,SDBEG,SDEND,SDACT,SDERR) ; -- SDQ DATE RANGE [API ID: 82]
D PREP^SDQUT
G DATEG^SDQPROP
;
GETDATE(SDQ,SDERR) ; -- get date range property [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDBEG,SDEND
D DATE^SDQPROP(.SDQ,.SDBEG,.SDEND,"GET",$G(SDERR))
Q $G(SDBEG)_"^"_$G(SDEND)
;
FILTER(SDQ,SDFIL,SDACT,SDERR) ; -- SDQ FILTER [API ID: 83]
D PREP^SDQUT
G FILTERG^SDQPROP
;
GETFIL(SDQ,SDERR) ; -- get filter property [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDFIL
D FILTER^SDQPROP(.SDQ,.SDFIL,"GET",$G(SDERR))
Q $G(SDFIL)
;
VISIT(SDQ,SDVST,SDACT,SDERR) ; -- SDQ VISIT [API ID: 84]
D PREP^SDQUT
G VISITG^SDOEQ
;
GETVISIT(SDQ,SDERR) ; -- get visit property [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDVST
D VISIT^SDOEQ(.SDQ,.SDVST,.SDACT,$G(SDERR))
Q $G(SDVST)
;
INDEX(SDQ,SDIDX,SDACT,SDERR) ; -- SDQ INDEX NAME [API ID: 85]
D PREP^SDQUT
G INDEXG^SDQPROP
;
GETINDEX(SDQ,SDERR) ; -- get index property [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDIDX
D INDEX^SDQPROP(.SDQ,.SDIDX,"GET",$G(SDERR))
Q $G(SDIDX)
;
ACTIVE(SDQ,SDSTAT,SDACT,SDERR) ; -- SDQ ACTIVE STATUS [API ID: 88]
D PREP^SDQUT
G ACTIVEG^SDQPROP
;
GETACT(SDQ,SDERR) ; -- activate query [API ID: 1xx]
; -- not supported
D PREP^SDQUT
N SDSTAT
D ACTIVE^SDQPROP(.SDQ,.SDSTAT,.SDACT,$G(SDERR))
Q $G(SDSTAT)
;
REFRESH(SDQ,SDERR) ; -- SDQ REFRESH [API ID: 94]
D PREP^SDQUT
G REFRESHG^SDQUT
;
SCAN(SDQ,SDIR,SDERR) ; -- SDQ SCAN [API ID: 99]
D PREP^SDQUT
G SCANG^SDQNAV
;
SCANCB(SDQ,SDCB,SDACT,SDERR) ; -- SDQ SCAN CALLBACK [API ID: 100]
D PREP^SDQUT
G SCANCBG^SDQNAV
;
NEXT(SDQ,SDERR) ; -- SDQ NEXT [API ID: 92]
D PREP^SDQUT
G NEXTG^SDQNAV
;
PRIOR(SDQ,SDERR) ; -- SDQ PRIOR [API ID: 93]
D PREP^SDQUT
G PRIORG^SDQNAV
;
FIRST(SDQ,SDERR) ; -- SDQ FIRST [API ID: 90]
D PREP^SDQUT
G FIRSTG^SDQNAV
;
LAST(SDQ,SDERR) ; -- SDQ LAST [API ID: 91]
D PREP^SDQUT
G LASTG^SDQNAV
;
EOF(SDQ,SDERR) ; -- SDQ EOF [API ID: 86]
D PREP^SDQUT
Q $$EOF^SDQNAV(.SDQ,$G(SDERR))
;
BOF(SDQ,SDERR) ; -- SDQ BOF [API ID: 87]
D PREP^SDQUT
Q $$BOF^SDQNAV(.SDQ,$G(SDERR))
;
COUNT(SDQ,SDERR) ; -- SDQ COUNT [API ID: 89]
D PREP^SDQUT
Q $$COUNT^SDQNAV(.SDQ,$G(SDERR))
;
GETENTRY(SDQ,SDERR) ; -- SDQ GET CURRENT ENTRY ID [API ID: 95]
D PREP^SDQUT
Q $$GETENTRY^SDQUT(.SDQ,$G(SDERR))
;
SDQ ;ALB/MJK - Query Object Methods ;8/12/96
+1 ;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
+2 ;
OPEN(SDQ,SDERR) ; -- SDQ OPEN [API ID: 79]
+1 DO PREP^SDQUT
+2 ;
+3 ; -- get query object instance and set up query class info
+4 IF '$$CREATE(.SDQ,"SD STANDARD ENCOUNTER QUERY",$GET(SDERR))
GOTO OPENQ
+5 ;
+6 ; -- do query object instance kills and sets
+7 KILL @SDQUERY@(SDQ)
+8 SET @SDQUERY@(SDQ)=""
+9 FOR X="SCAN"
MERGE @SDQUERY@(SDQ,X)=^TMP("SDQUERY CLASS",$JOB,SDQ,X)
+10 DO STOP^SDQPROP(.SDQ)
+11 ;
+12 ; -- do open actions
+13 NEW SDOPEN
+14 SET SDOPEN=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"OPEN"))
+15 IF SDOPEN]""
XECUTE SDOPEN
OPENQ QUIT
+1 ;
CLOSE(SDQ,SDERR) ; -- SDQ CLOSE [API ID: 80]
+1 DO PREP^SDQUT
+2 ;
+3 ; -- do validation checks
+4 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO CLOSEQ
+5 ;
+6 ; -- do close actions
+7 NEW SDCLOSE
+8 SET SDCLOSE=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"CLOSE"))
+9 IF SDCLOSE]""
XECUTE SDCLOSE
+10 ;
+11 ; -- do query object instance kills
+12 KILL @SDQUERY@(SDQ)
+13 ;
+14 ; -- do query class kills
+15 IF '$$DESTROY(.SDQ)
GOTO CLOSEQ
+16 SET SDQ=""
CLOSEQ QUIT
+1 ;
CREATE(SDQ,SDQNAME,SDERR) ; -- query class level method for CREATE
+1 NEW SDCLS,SDCLS0,SDOK,SDSTORE
+2 SET SDCLS=+$ORDER(^SD(409.64,"B",SDQNAME,0))
+3 IF SDCLS
Begin DoDot:1
+4 SET SDCLS0=$GET(^SD(409.64,SDCLS,0))
+5 SET SDSTORE=$SELECT($PIECE(SDCLS0,U,4):$PIECE(SDCLS0,U,4),1:5000)
+6 IF $GET(SDQUERY)=""
SET SDQUERY="SDQDATA"
+7 DO STORE(.SDQUERY,SDSTORE)
+8 IF '$ORDER(@SDQUERY@(0))
DO KILL
+9 ;
+10 ; -- set query id
+11 SET (SDQ,@SDQUERY)=$GET(@SDQUERY)+1
+12 ; -- set up tmp class info
+13 KILL ^TMP("SDQUERY CLASS",$JOB,SDQ)
+14 MERGE ^TMP("SDQUERY CLASS",$JOB,SDQ)=^SD(409.64,SDCLS)
+15 SET ^TMP("SDQUERY CLASS",$JOB,SDQ)=SDCLS
+16 SET ^TMP("SDQUERY CLASS",$JOB,SDQ,"GL")=$GET(^DIC(+$PIECE(SDCLS0,"^",2),0,"GL"))
+17 ; -- subscript level of files root ; ex:^SCE = 0 ; ex:^SD(404.42, = 1
+18 SET ^TMP("SDQUERY CLASS",$JOB,SDQ,"GL SUBSCRIPTS")=+$PIECE(SDCLS0,"^",3)
+19 ;
+20 SET SDOK=1
End DoDot:1
+21 IF '$TEST
Begin DoDot:1
+22 ; -- build error msg
+23 NEW SDIN,SDOUT
+24 SET SDIN("CLASS")=SDQNAME
+25 SET SDOUT("CLASS")=SDQNAME
+26 DO BLD^SDQVAL(4096400.001,.SDIN,.SDOUT,$GET(SDERR))
+27 SET SDOK=0
End DoDot:1
+28 ;
+29 QUIT SDOK
+30 ;
STORE(SDQUERY,SDSTORE) ; -- decide whether to use a local or global
+1 NEW SDOLD
+2 IF $STORAGE<SDSTORE
IF SDQUERY'["^TMP"
Begin DoDot:1
+3 SET SDOLD=SDQUERY
+4 SET SDQUERY=$NAME(^TMP("SDQDATA",$JOB))
+5 KILL @SDQUERY
+6 MERGE @SDQUERY=@SDOLD
+7 KILL @SDOLD
End DoDot:1
+8 QUIT
+9 ;
DESTROY(SDQ) ; -- query class level method for DESTROY
+1 KILL ^TMP("SDQUERY CLASS",$JOB,SDQ)
+2 IF '$ORDER(@SDQUERY@(0))
DO KILL
KILL SDQUERY
+3 QUIT 1
+4 ;
KILL ; -- kill class and ien list globals
+1 KILL ^TMP("SDQUERY CLASS",$JOB)
+2 KILL ^TMP("SDQUERY LIST",$JOB)
+3 KILL @SDQUERY
+4 QUIT
+5 ;
+6 ;
PAT(SDQ,SDFN,SDACT,SDERR) ; -- SDQ PATIENT [API ID: 81]
+1 DO PREP^SDQUT
+2 GOTO PATG^SDOEQ
+3 ;
GETPAT(SDQ,SDERR) ; -- get patient property [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDFN
+4 DO PAT^SDOEQ(.SDQ,.SDFN,"GET",$GET(SDERR))
+5 QUIT $GET(SDFN)
+6 ;
DATE(SDQ,SDBEG,SDEND,SDACT,SDERR) ; -- SDQ DATE RANGE [API ID: 82]
+1 DO PREP^SDQUT
+2 GOTO DATEG^SDQPROP
+3 ;
GETDATE(SDQ,SDERR) ; -- get date range property [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDBEG,SDEND
+4 DO DATE^SDQPROP(.SDQ,.SDBEG,.SDEND,"GET",$GET(SDERR))
+5 QUIT $GET(SDBEG)_"^"_$GET(SDEND)
+6 ;
FILTER(SDQ,SDFIL,SDACT,SDERR) ; -- SDQ FILTER [API ID: 83]
+1 DO PREP^SDQUT
+2 GOTO FILTERG^SDQPROP
+3 ;
GETFIL(SDQ,SDERR) ; -- get filter property [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDFIL
+4 DO FILTER^SDQPROP(.SDQ,.SDFIL,"GET",$GET(SDERR))
+5 QUIT $GET(SDFIL)
+6 ;
VISIT(SDQ,SDVST,SDACT,SDERR) ; -- SDQ VISIT [API ID: 84]
+1 DO PREP^SDQUT
+2 GOTO VISITG^SDOEQ
+3 ;
GETVISIT(SDQ,SDERR) ; -- get visit property [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDVST
+4 DO VISIT^SDOEQ(.SDQ,.SDVST,.SDACT,$GET(SDERR))
+5 QUIT $GET(SDVST)
+6 ;
INDEX(SDQ,SDIDX,SDACT,SDERR) ; -- SDQ INDEX NAME [API ID: 85]
+1 DO PREP^SDQUT
+2 GOTO INDEXG^SDQPROP
+3 ;
GETINDEX(SDQ,SDERR) ; -- get index property [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDIDX
+4 DO INDEX^SDQPROP(.SDQ,.SDIDX,"GET",$GET(SDERR))
+5 QUIT $GET(SDIDX)
+6 ;
ACTIVE(SDQ,SDSTAT,SDACT,SDERR) ; -- SDQ ACTIVE STATUS [API ID: 88]
+1 DO PREP^SDQUT
+2 GOTO ACTIVEG^SDQPROP
+3 ;
GETACT(SDQ,SDERR) ; -- activate query [API ID: 1xx]
+1 ; -- not supported
+2 DO PREP^SDQUT
+3 NEW SDSTAT
+4 DO ACTIVE^SDQPROP(.SDQ,.SDSTAT,.SDACT,$GET(SDERR))
+5 QUIT $GET(SDSTAT)
+6 ;
REFRESH(SDQ,SDERR) ; -- SDQ REFRESH [API ID: 94]
+1 DO PREP^SDQUT
+2 GOTO REFRESHG^SDQUT
+3 ;
SCAN(SDQ,SDIR,SDERR) ; -- SDQ SCAN [API ID: 99]
+1 DO PREP^SDQUT
+2 GOTO SCANG^SDQNAV
+3 ;
SCANCB(SDQ,SDCB,SDACT,SDERR) ; -- SDQ SCAN CALLBACK [API ID: 100]
+1 DO PREP^SDQUT
+2 GOTO SCANCBG^SDQNAV
+3 ;
NEXT(SDQ,SDERR) ; -- SDQ NEXT [API ID: 92]
+1 DO PREP^SDQUT
+2 GOTO NEXTG^SDQNAV
+3 ;
PRIOR(SDQ,SDERR) ; -- SDQ PRIOR [API ID: 93]
+1 DO PREP^SDQUT
+2 GOTO PRIORG^SDQNAV
+3 ;
FIRST(SDQ,SDERR) ; -- SDQ FIRST [API ID: 90]
+1 DO PREP^SDQUT
+2 GOTO FIRSTG^SDQNAV
+3 ;
LAST(SDQ,SDERR) ; -- SDQ LAST [API ID: 91]
+1 DO PREP^SDQUT
+2 GOTO LASTG^SDQNAV
+3 ;
EOF(SDQ,SDERR) ; -- SDQ EOF [API ID: 86]
+1 DO PREP^SDQUT
+2 QUIT $$EOF^SDQNAV(.SDQ,$GET(SDERR))
+3 ;
BOF(SDQ,SDERR) ; -- SDQ BOF [API ID: 87]
+1 DO PREP^SDQUT
+2 QUIT $$BOF^SDQNAV(.SDQ,$GET(SDERR))
+3 ;
COUNT(SDQ,SDERR) ; -- SDQ COUNT [API ID: 89]
+1 DO PREP^SDQUT
+2 QUIT $$COUNT^SDQNAV(.SDQ,$GET(SDERR))
+3 ;
GETENTRY(SDQ,SDERR) ; -- SDQ GET CURRENT ENTRY ID [API ID: 95]
+1 DO PREP^SDQUT
+2 QUIT $$GETENTRY^SDQUT(.SDQ,$GET(SDERR))
+3 ;