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

SDVSIT2.m

Go to the documentation of this file.
  1. 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
  1. ;;Per VHA Directive 2004-038, this routine should not be modified
  1. ;; ;
  1. ;
  1. GETAPT(DFN,SDT,SDCL,SDVIEN) ;Look-up Outpatient Encounter IEN for Appt
  1. ; This utility will return the existing IEN for an Outpatient
  1. ; Encounter. If it fails to find an existing encounter,
  1. ; it will create a new Encounter and return the new IEN.
  1. ;
  1. ; Input -- DFN Patient file IEN
  1. ; SDT Appointment Date/Time
  1. ; SDCL Hospital Location file IEN for Appt
  1. ; SDVIEN Visit file pointer [optional]
  1. ; Output -- Outpatient Encounter file IEN
  1. N Y
  1. S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
  1. I 'Y D APPT^SDVSIT(DFN,SDT,SDCL,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"S",SDT,0)),"^",20)
  1. IF Y D VIEN(Y,$G(SDVIEN))
  1. Q +$G(Y)
  1. ;
  1. GETAE(SDVIEN,SDATYPE,SDOPE) ;Look-up Outpatient Encounter IEN for add/edit
  1. ; Input -- SDVIEN Visit file pointer
  1. ; SDATYPE Appointment Type [optional]
  1. ; SDOEP Parent encounter ien [optional]
  1. ;
  1. ; Output -- Outpatient Encounter file IEN
  1. N Y
  1. S Y=+$O(^SCE("AVSIT",SDVIEN,0))
  1. I 'Y D AEUPD^SDVSIT(SDVIEN,$G(SDATYPE),$G(SDOPE)) S Y=+$O(^SCE("AVSIT",SDVIEN,0))
  1. IF Y D VIEN(Y,SDVIEN)
  1. Q +$G(Y)
  1. ;
  1. GETDISP(DFN,SDT,SDVIEN) ;Look-up Outpatient Encounter IEN for disposition
  1. ; Input -- DFN Patient file IEN
  1. ; SDT Disposition Date/Time
  1. ; SDVIEN Visit file pointer [optional]
  1. ; Output -- Outpatient Encounter file IEN
  1. N Y
  1. S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
  1. I 'Y D DISP^SDVSIT(DFN,SDT,$G(SDVIEN)) S Y=+$P($G(^DPT(DFN,"DIS",9999999-SDT,0)),"^",18)
  1. IF Y D VIEN(Y,$G(SDVIEN))
  1. Q +$G(Y)
  1. ;
  1. OKAE(SDOE) ; -- is add/edit ok for credit
  1. N Y,X S Y=1
  1. S X=$G(^SCE(SDOE,0))
  1. I $$REQ^SDM1A(+X)="CO",'$P(X,U,7) S Y=0
  1. Q Y
  1. ;
  1. VIEN(SDOE,SDVIEN) ; -- stuff in Visit IEN if not already set
  1. ; -- needed for those sites that don't have
  1. ; scheduling turned on in Visit Tracking
  1. ; Required input SDOE = Outpatient Encounter pointer
  1. ; SDVIEN = Visit file pointer or null or zero
  1. ;
  1. ; -- quit if no vien passed
  1. G VIENQ:'SDVIEN
  1. N Y,SDOE0
  1. S SDOE0=$G(^SCE(+SDOE,0))
  1. ; -- quit is no encounter
  1. G VIENQ:SDOE0=""
  1. ; -- set visit ien if vien not already set
  1. IF '$P(SDOE0,U,5) D
  1. . N DIE,DA,DR
  1. . S DIE="^SCE(",DA=SDOE,DR=".05////"_SDVIEN D ^DIE
  1. IF '$P(SDOE0,U,4) D
  1. . N DIE,DA,DR,SDLOC
  1. . S SDLOC=$P($G(^AUPNVSIT(SDVIEN,0)),U,22)
  1. . IF SDLOC S DIE="^SCE(",DA=SDOE,DR=".04////"_SDLOC D ^DIE
  1. VIENQ Q
  1. ;