SDVSIT2 ;ALB/RMO/MJK - Encounter Utilities;28 DEC 1992 10:00 am
;;5.3;Scheduling;**27,44,132,723**;08/13/93;Build 21
;;Per VHA Directive 2004-038, this routine should not be modified
;; ;
;
GETAPT(DFN,SDT,SDCL,SDVIEN) ;Look-up Outpatient Encounter IEN for Appt
; This utility will return the existing IEN for an Outpatient
; Encounter. If it fails to find an existing encounter,
; it will create a new Encounter and return the new IEN.
;
; Input -- DFN Patient file IEN
; SDT Appointment Date/Time
; SDCL Hospital Location file IEN for Appt
; SDVIEN Visit file pointer [optional]
; Output -- Outpatient Encounter file IEN
N Y
S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
I 'Y D APPT^SDVSIT(DFN,SDT,SDCL,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
IF Y D VIEN(Y,$G(SDVIEN))
Q +$G(Y)
;
GETAE(SDVIEN,SDATYPE,SDOPE) ;Look-up Outpatient Encounter IEN for add/edit
; Input -- SDVIEN Visit file pointer
; SDATYPE Appointment Type [optional]
; SDOEP Parent encounter ien [optional]
;
; Output -- Outpatient Encounter file IEN
N Y
S Y=+$O(^SCE("AVSIT",SDVIEN,0))
I 'Y D AEUPD^SDVSIT(SDVIEN,$G(SDATYPE),$G(SDOPE)) S Y=+$O(^SCE("AVSIT",SDVIEN,0))
IF Y D VIEN(Y,SDVIEN)
Q +$G(Y)
;
GETDISP(DFN,SDT,SDVIEN) ;Look-up Outpatient Encounter IEN for disposition
; Input -- DFN Patient file IEN
; SDT Disposition Date/Time
; SDVIEN Visit file pointer [optional]
; Output -- Outpatient Encounter file IEN
N Y
S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
I 'Y D DISP^SDVSIT(DFN,SDT,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
IF Y D VIEN(Y,$G(SDVIEN))
Q +$G(Y)
;
OKAE(SDOE) ; -- is add/edit ok for credit
N Y,X S Y=1
S X=$G(^SCE(SDOE,0))
I $$REQ^SDM1A(+X)="CO",'$P(X,U,7) S Y=0
Q Y
;
VIEN(SDOE,SDVIEN) ; -- stuff in Visit IEN if not already set
; -- needed for those sites that don't have
; scheduling turned on in Visit Tracking
; Required input SDOE = Outpatient Encounter pointer
; SDVIEN = Visit file pointer or null or zero
;
; -- quit if no vien passed
G VIENQ:'SDVIEN
N Y,SDOE0
S SDOE0=$G(^SCE(+SDOE,0))
; -- quit is no encounter
G VIENQ:SDOE0=""
; -- set visit ien if vien not already set
IF '$P(SDOE0,U,5) D
. N DIE,DA,DR
. S DIE="^SCE(",DA=SDOE,DR=".05////"_SDVIEN D ^DIE
IF '$P(SDOE0,U,4) D
. N DIE,DA,DR,SDLOC
. S SDLOC=$P($G(^AUPNVSIT(SDVIEN,0)),U,22)
. IF SDLOC S DIE="^SCE(",DA=SDOE,DR=".04////"_SDLOC D ^DIE
VIENQ Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDVSIT2 2649 printed Dec 13, 2024@03:02:04 Page 2
SDVSIT2 ;ALB/RMO/MJK - Encounter Utilities;28 DEC 1992 10:00 am
+1 ;;5.3;Scheduling;**27,44,132,723**;08/13/93;Build 21
+2 ;;Per VHA Directive 2004-038, this routine should not be modified
+3 ;; ;
+4 ;
GETAPT(DFN,SDT,SDCL,SDVIEN) ;Look-up Outpatient Encounter IEN for Appt
+1 ; This utility will return the existing IEN for an Outpatient
+2 ; Encounter. If it fails to find an existing encounter,
+3 ; it will create a new Encounter and return the new IEN.
+4 ;
+5 ; Input -- DFN Patient file IEN
+6 ; SDT Appointment Date/Time
+7 ; SDCL Hospital Location file IEN for Appt
+8 ; SDVIEN Visit file pointer [optional]
+9 ; Output -- Outpatient Encounter file IEN
+10 NEW Y
+11 SET Y=+$PIECE($GET(^DPT(DFN,"S",SDT,0)),"^",20)
+12 IF 'Y
DO APPT^SDVSIT(DFN,SDT,SDCL,$GET(SDVIEN))
SET Y=+$PIECE($GET(^DPT(DFN,"S",SDT,0)),"^",20)
+13 IF Y
DO VIEN(Y,$GET(SDVIEN))
+14 QUIT +$GET(Y)
+15 ;
GETAE(SDVIEN,SDATYPE,SDOPE) ;Look-up Outpatient Encounter IEN for add/edit
+1 ; Input -- SDVIEN Visit file pointer
+2 ; SDATYPE Appointment Type [optional]
+3 ; SDOEP Parent encounter ien [optional]
+4 ;
+5 ; Output -- Outpatient Encounter file IEN
+6 NEW Y
+7 SET Y=+$ORDER(^SCE("AVSIT",SDVIEN,0))
+8 IF 'Y
DO AEUPD^SDVSIT(SDVIEN,$GET(SDATYPE),$GET(SDOPE))
SET Y=+$ORDER(^SCE("AVSIT",SDVIEN,0))
+9 IF Y
DO VIEN(Y,SDVIEN)
+10 QUIT +$GET(Y)
+11 ;
GETDISP(DFN,SDT,SDVIEN) ;Look-up Outpatient Encounter IEN for disposition
+1 ; Input -- DFN Patient file IEN
+2 ; SDT Disposition Date/Time
+3 ; SDVIEN Visit file pointer [optional]
+4 ; Output -- Outpatient Encounter file IEN
+5 NEW Y
+6 SET Y=+$PIECE($GET(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
+7 IF 'Y
DO DISP^SDVSIT(DFN,SDT,$GET(SDVIEN))
SET Y=+$PIECE($GET(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
+8 IF Y
DO VIEN(Y,$GET(SDVIEN))
+9 QUIT +$GET(Y)
+10 ;
OKAE(SDOE) ; -- is add/edit ok for credit
+1 NEW Y,X
SET Y=1
+2 SET X=$GET(^SCE(SDOE,0))
+3 IF $$REQ^SDM1A(+X)="CO"
IF '$PIECE(X,U,7)
SET Y=0
+4 QUIT Y
+5 ;
VIEN(SDOE,SDVIEN) ; -- stuff in Visit IEN if not already set
+1 ; -- needed for those sites that don't have
+2 ; scheduling turned on in Visit Tracking
+3 ; Required input SDOE = Outpatient Encounter pointer
+4 ; SDVIEN = Visit file pointer or null or zero
+5 ;
+6 ; -- quit if no vien passed
+7 if 'SDVIEN
GOTO VIENQ
+8 NEW Y,SDOE0
+9 SET SDOE0=$GET(^SCE(+SDOE,0))
+10 ; -- quit is no encounter
+11 if SDOE0=""
GOTO VIENQ
+12 ; -- set visit ien if vien not already set
+13 IF '$PIECE(SDOE0,U,5)
Begin DoDot:1
+14 NEW DIE,DA,DR
+15 SET DIE="^SCE("
SET DA=SDOE
SET DR=".05////"_SDVIEN
DO ^DIE
End DoDot:1
+16 IF '$PIECE(SDOE0,U,4)
Begin DoDot:1
+17 NEW DIE,DA,DR,SDLOC
+18 SET SDLOC=$PIECE($GET(^AUPNVSIT(SDVIEN,0)),U,22)
+19 IF SDLOC
SET DIE="^SCE("
SET DA=SDOE
SET DR=".04////"_SDLOC
DO ^DIE
End DoDot:1
VIENQ QUIT
+1 ;