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

SDAMA204.m

Go to the documentation of this file.
  1. SDAMA204 ;BPOIFO/NDH-Scheduling Replacement APIs ; 12/13/04 3:16pm
  1. ;;5.3;Scheduling;**310,347,1015**;13 Aug 1993;Build 21
  1. ;
  1. ;PATAPPT - Determines if an appointment exists for a patient.
  1. ;
  1. ;** BEFORE USING THE API IN THIS ROUTINE, PLEASE SUBSCRIBE **
  1. ;** TO DBIA #4216 **
  1. ;
  1. ;*****************************************************************
  1. ; CHANGE LOG
  1. ;
  1. ; DATE PATCH DESCRIPTION
  1. ;-------- ---------- -----------------------------------------
  1. ;08/11/03 SD*5.3*310 API PATIENT APPOINTMENT EXISTS
  1. ;07/26/04 SD*5.3*347 API Patient Appointment supports distributed
  1. ; appointment files (whether actual files are
  1. ; located in VistA DB or Oracle DB).
  1. ;
  1. ;*****************************************************************
  1. ;
  1. PATAPPT(SDDFN) ; Check for existence of any appointment for a patient
  1. ;
  1. ; This API is an extrinsic function that returns 1 of 3 values.
  1. ; The API checks for the existence of appointment records.
  1. ;
  1. ; INPUT SDDFN : Patient's DFN number (required)
  1. ;
  1. ; OUTPUT 1 : Appointment(s) on file
  1. ; 0 : No appointment(s) on file
  1. ; -1 : Error
  1. ;
  1. ; ERROR CODES - 101 : Database is Unavailable
  1. ; 102 : Patient ID is required
  1. ; 110 : Patient ID must be numeric
  1. ; 114 : Invalid Patient ID
  1. ; 117 : SDAPI Error
  1. ;
  1. ; ERROR LOCATION : ^TMP($J,"SDAMA204","PATAPPT","ERROR")
  1. ;
  1. ; Check for proper parameter and return -1 if bad DFN
  1. ;
  1. ; Initialize node for error reporting
  1. K ^TMP($J,"SDAMA204","PATAPPT")
  1. N SDARRAY,SDCOUNT,SDX,SDY,DFN,VAERR
  1. ;
  1. ; Check for no input parameter
  1. I '$D(SDDFN) D Q -1
  1. .D ERROR^SDAMA200(102,"PATAPPT",0,"SDAMA204")
  1. ; Check if SDDFN is numeric
  1. I SDDFN'?1.N D Q -1
  1. .D ERROR^SDAMA200(110,"PATAPPT",0,"SDAMA204")
  1. ; Check if DFN exists or is 0
  1. S DFN=SDDFN
  1. D DEM^VADPT
  1. I SDDFN=0!VAERR=1 D Q -1
  1. .D ERROR^SDAMA200(114,"PATAPPT",0,"SDAMA204")
  1. D KVAR^VADPT
  1. ; Check for patient appointments and return 1 if appointment found
  1. ; and 0 if no appointments found.
  1. ;
  1. S SDARRAY(4)=DFN,SDARRAY("FLDS")=1,SDARRAY("MAX")=1
  1. S SDCOUNT=$$SDAPI^SDAMA301(.SDARRAY)
  1. I SDCOUNT=0 Q 0 ; No Appt found.
  1. I SDCOUNT=1 K ^TMP($J,"SDAMA301") Q 1 ; Appt(s). found.
  1. ; Error Encountered.
  1. I SDCOUNT=-1 D
  1. .S SDX=$O(^TMP($J,"SDAMA301",""))
  1. .S SDX=$S(SDX=101:101,SDX=115:114,SDX=116:114,1:117)
  1. .D ERROR^SDAMA200(SDX,"PATAPPT",0,"SDAMA204")
  1. .K ^TMP($J,"SDAMA301")
  1. Q -1