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

SDESGETAPPTSIEN2.m

Go to the documentation of this file.
SDESGETAPPTSIEN2 ;ALB/DJS - SDES GET APPTS BY IEN2 RPC ; May 24, 2023
 ;;5.3;SCHEDULING;**846**;AUG 13, 1993;Build 12
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 ; Copy of SDESGETAPPTSIEN
 ;
 Q
 ;
APPTSLISTBYIEN(APPTSLISTJSON,EASAUDITID,APPTIENS,SDEASARRAY) ;
 N APPTDATA,NODE,SEQ,IEN,RETURNDATA,APPTLIST,ERRORS,SDEAS,SDESCNT,VALAPPT,MAX
 S (APPTDATA,NODE,IEN,RETURNDATA,APPTLIST,SDEAS,SDESCNT)=""
 S (SEQ,MAX)=0
 ;
 F  S NODE=$O(APPTIENS(NODE)) Q:NODE=""!(MAX)  D
 . S SEQ=SEQ+1
 . I SEQ>50 D ERRLOG^SDESJSON(.ERRORS,429) S MAX=1 Q
 . ;
 . S IEN=$G(APPTIENS(NODE))
 . S VALAPPT=$$VALAPPTIEN(.ERRORS,IEN) Q:'VALAPPT
 . ;
 . S SDEAS=$G(SDEASARRAY(NODE),"")
 . N APPTDATA,RETURNDATA
 . D GETAPPTBYIEN^SDESGETAPPTWRAP4(.RETURNDATA,IEN,SDEAS)
 . D DECODE^XLFJSON("RETURNDATA","APPTDATA")
 . M APPTLIST("Appointment",SEQ)=APPTDATA("Appointment","1")
 . K APPTDATA,RETURNDATA
 . Q
 M APPTLIST=ERRORS
 I '$D(APPTLIST) S APPTLIST("Appointment",1)=""
 D BUILDJSON(.APPTSLISTJSON,.APPTLIST)
 Q
BUILDJSON(APPTSLISTJSON,APPTLIST) ;Convert data to JSON
 N JSONERR
 S JSONERR=""
 D BUILDJSON^SDESBUILDJSON(.APPTSLISTJSON,.APPTLIST)
 Q
 ; validate appointment ID/IEN
VALAPPTIEN(ERRORS,APPTIEN) ;
 I '$L(APPTIEN) D ERRLOG^SDESJSON(.ERRORS,14) Q 0
 I 'APPTIEN D ERRLOG^SDESJSON(.ERRORS,15,APPTIEN) Q 0
 I APPTIEN,'$D(^SDEC(409.84,APPTIEN)) D ERRLOG^SDESJSON(.ERRORS,15,APPTIEN) Q 0
 Q 1