SCUTIE1 ;ALB/SCK - INCOMPLETE ENCOUNTER MGMT API CALLS ; 6/17/97
;;5.3;Scheduling;**66,1015**;AUG 13, 1993;Build 21
;
Q
;
OPENC(SDXMT,SDARRAY) ; API to return whether Transmitted Outpatient Encounter File entry
; points to a deleted encounter.
;
; Input:
; SDXMT - IEN of the Transmitted Outpatient Encounter file entry
; SDARRAY - [optional] - if passed in (as "xxxx"), will return encounter information
; DFN, Clinic IEN, and Encounter date
;
; Return:
; 1 - if encounter is deleted
; 0 - if encounter is not deleted.
; -1 - if error condition
;
; If SDARRAY is passed in, returns:
; SDARRAY["DFN"] = DFN
; SDARRAY["CLINIC"] = Clinic IEN
; SDARRAY["ENCOUNTER"] = Encounter date
; SDARRAY["ERROR"] = Error Condition
; SDARRAY["DELIEN"] = Ien of Deleted Encounter
; SDARRAY["SDOIEN"] = Ien of OP Encounter
; SDARRAY["AE"] = 0 if Originating process is an appointment,
; 1 if not.
;
N SDOK,NODE0,NODE1
;
K @SDARRAY
I +$G(SDXMT)=0 D G DELQ
. S SDOK=-1
. I $G(SDARRAY)]"" S @SDARRAY@("ERROR")="NULL XMT POINTER"
;
I +$P($G(^SD(409.73,SDXMT,0)),U,2)>0,$D(^SCE(+$P(^SD(409.73,SDXMT,0),U,2))) D G DELQ
. S SDOK=0
. I $G(SDARRAY)]"" D
.. K @SDARRAY
.. S NODE0=$G(^SCE($P(^SD(409.73,SDXMT,0),U,2),0))
.. S @SDARRAY@("DFN")=$P(NODE0,U,2)
.. S @SDARRAY@("CLINIC")=$P(NODE0,U,4)
.. S @SDARRAY@("ENCOUNTER")=$P(NODE0,U)
.. S @SDARRAY@("SDOIEN")=$P(^SD(409.73,SDXMT,0),U,2)
.. S @SDARRAY@("AE")=$S($P(NODE0,U,8)=1:0,1:1)
;
I +$P($G(^SD(409.73,SDXMT,0)),U,3)>0,$D(^SD(409.74,+$P(^SD(409.73,SDXMT,0),U,3))) D G DELQ
. S SDOK=1
. I $G(SDARRAY)]"" D
.. K @SDARRAY
.. S NODE0=$G(^SD(409.74,$P(^SD(409.73,SDXMT,0),U,3),0))
.. S NODE1=$G(^SD(409.74,$P(^SD(409.73,SDXMT,0),U,3),1))
.. S @SDARRAY@("DFN")=$P(NODE0,U,2)
.. S @SDARRAY@("CLINIC")=$P(NODE1,U,4)
.. S @SDARRAY@("ENCOUNTER")=$P(NODE1,U)
.. S @SDARRAY@("DELIEN")=$P(^SD(409.73,SDXMT,0),U,3)
.. S @SDARRAY@("AE")=$S($P(NODE1,U,8)=1:0,1:1)
;
S SDOK=-1
I $G(SDARRAY)]"" S @SDARRAY@("ERROR")="No (Deleted) Outpatient Encounter entry found."
DELQ Q SDOK
SCUTIE1 ;ALB/SCK - INCOMPLETE ENCOUNTER MGMT API CALLS ; 6/17/97
+1 ;;5.3;Scheduling;**66,1015**;AUG 13, 1993;Build 21
+2 ;
+3 QUIT
+4 ;
OPENC(SDXMT,SDARRAY) ; API to return whether Transmitted Outpatient Encounter File entry
+1 ; points to a deleted encounter.
+2 ;
+3 ; Input:
+4 ; SDXMT - IEN of the Transmitted Outpatient Encounter file entry
+5 ; SDARRAY - [optional] - if passed in (as "xxxx"), will return encounter information
+6 ; DFN, Clinic IEN, and Encounter date
+7 ;
+8 ; Return:
+9 ; 1 - if encounter is deleted
+10 ; 0 - if encounter is not deleted.
+11 ; -1 - if error condition
+12 ;
+13 ; If SDARRAY is passed in, returns:
+14 ; SDARRAY["DFN"] = DFN
+15 ; SDARRAY["CLINIC"] = Clinic IEN
+16 ; SDARRAY["ENCOUNTER"] = Encounter date
+17 ; SDARRAY["ERROR"] = Error Condition
+18 ; SDARRAY["DELIEN"] = Ien of Deleted Encounter
+19 ; SDARRAY["SDOIEN"] = Ien of OP Encounter
+20 ; SDARRAY["AE"] = 0 if Originating process is an appointment,
+21 ; 1 if not.
+22 ;
+23 NEW SDOK,NODE0,NODE1
+24 ;
+25 KILL @SDARRAY
+26 IF +$GET(SDXMT)=0
Begin DoDot:1
+27 SET SDOK=-1
+28 IF $GET(SDARRAY)]""
SET @SDARRAY@("ERROR")="NULL XMT POINTER"
End DoDot:1
GOTO DELQ
+29 ;
+30 IF +$PIECE($GET(^SD(409.73,SDXMT,0)),U,2)>0
IF $DATA(^SCE(+$PIECE(^SD(409.73,SDXMT,0),U,2)))
Begin DoDot:1
+31 SET SDOK=0
+32 IF $GET(SDARRAY)]""
Begin DoDot:2
+33 KILL @SDARRAY
+34 SET NODE0=$GET(^SCE($PIECE(^SD(409.73,SDXMT,0),U,2),0))
+35 SET @SDARRAY@("DFN")=$PIECE(NODE0,U,2)
+36 SET @SDARRAY@("CLINIC")=$PIECE(NODE0,U,4)
+37 SET @SDARRAY@("ENCOUNTER")=$PIECE(NODE0,U)
+38 SET @SDARRAY@("SDOIEN")=$PIECE(^SD(409.73,SDXMT,0),U,2)
+39 SET @SDARRAY@("AE")=$SELECT($PIECE(NODE0,U,8)=1:0,1:1)
End DoDot:2
End DoDot:1
GOTO DELQ
+40 ;
+41 IF +$PIECE($GET(^SD(409.73,SDXMT,0)),U,3)>0
IF $DATA(^SD(409.74,+$PIECE(^SD(409.73,SDXMT,0),U,3)))
Begin DoDot:1
+42 SET SDOK=1
+43 IF $GET(SDARRAY)]""
Begin DoDot:2
+44 KILL @SDARRAY
+45 SET NODE0=$GET(^SD(409.74,$PIECE(^SD(409.73,SDXMT,0),U,3),0))
+46 SET NODE1=$GET(^SD(409.74,$PIECE(^SD(409.73,SDXMT,0),U,3),1))
+47 SET @SDARRAY@("DFN")=$PIECE(NODE0,U,2)
+48 SET @SDARRAY@("CLINIC")=$PIECE(NODE1,U,4)
+49 SET @SDARRAY@("ENCOUNTER")=$PIECE(NODE1,U)
+50 SET @SDARRAY@("DELIEN")=$PIECE(^SD(409.73,SDXMT,0),U,3)
+51 SET @SDARRAY@("AE")=$SELECT($PIECE(NODE1,U,8)=1:0,1:1)
End DoDot:2
End DoDot:1
GOTO DELQ
+52 ;
+53 SET SDOK=-1
+54 IF $GET(SDARRAY)]""
SET @SDARRAY@("ERROR")="No (Deleted) Outpatient Encounter entry found."
DELQ QUIT SDOK