SDESGETAPPTSIEN ;ALB/CGP - Get Appointment info by IEN list ;Feb 17, 2023@09:47
;;5.3;Scheduling;**838**;Feb 17, 2023;Build 7
;;Per VHA Directive 6402, this routine should not be modified
;
;
Q
;
APPTSLISTBYIEN(APPTSLISTJSON,EASAUDITID,APPTIENS,SDEASARRAY) ;
N APPTDATA,NODE,SEQUENCE,IEN,RETURNDATA,APPTLIST,ERRORS,SDEAS
S (APPTDATA,NODE,IEN,RETURNDATA,APPTLIST,SDEAS)=""
S (SEQUENCE)=0
;
F S NODE=$O(APPTIENS(NODE)) Q:NODE="" D
. N ERRORS
. S IEN=$G(APPTIENS(NODE))
. I IEN="" D ERRLOG^SDESJSON(.ERRORS,14)
. I $D(ERRORS) M APPTLIST("Error","Sequence "_NODE)=ERRORS Q
. S SEQUENCE=SEQUENCE+1
. I SEQUENCE>50 D ERRLOG^SDESJSON(.ERRORS,429)
. I $D(ERRORS) M APPTLIST("Error","Max")=ERRORS Q
. ;
. S SDEAS=$G(SDEASARRAY(NODE),"")
. N APPTDATA
. D GETAPPTBYIEN^SDESGETAPPTWRAP4(.RETURNDATA,IEN,SDEAS)
. D DECODE^XLFJSON("RETURNDATA","APPTDATA")
. I $D(APPTDATA("Error")) M APPTLIST("Error","AppointmentIEN "_IEN)=APPTDATA("Error")
. I '$D(APPTDATA("Error")) M APPTLIST("Appointment",SEQUENCE)=APPTDATA("Appointment")
. Q
D BUILDJSON(.APPTSLISTJSON,.APPTLIST)
Q
BUILDJSON(APPTSLISTJSON,APPTLIST) ;Convert data to JSON
N JSONERR
S JSONERR=""
D BUILDJSON^SDESBUILDJSON(.APPTSLISTJSON,.APPTLIST)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETAPPTSIEN 1264 printed Dec 13, 2024@02:56:38 Page 2
SDESGETAPPTSIEN ;ALB/CGP - Get Appointment info by IEN list ;Feb 17, 2023@09:47
+1 ;;5.3;Scheduling;**838**;Feb 17, 2023;Build 7
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ;
+5 QUIT
+6 ;
APPTSLISTBYIEN(APPTSLISTJSON,EASAUDITID,APPTIENS,SDEASARRAY) ;
+1 NEW APPTDATA,NODE,SEQUENCE,IEN,RETURNDATA,APPTLIST,ERRORS,SDEAS
+2 SET (APPTDATA,NODE,IEN,RETURNDATA,APPTLIST,SDEAS)=""
+3 SET (SEQUENCE)=0
+4 ;
+5 FOR
SET NODE=$ORDER(APPTIENS(NODE))
if NODE=""
QUIT
Begin DoDot:1
+6 NEW ERRORS
+7 SET IEN=$GET(APPTIENS(NODE))
+8 IF IEN=""
DO ERRLOG^SDESJSON(.ERRORS,14)
+9 IF $DATA(ERRORS)
MERGE APPTLIST("Error","Sequence "_NODE)=ERRORS
QUIT
+10 SET SEQUENCE=SEQUENCE+1
+11 IF SEQUENCE>50
DO ERRLOG^SDESJSON(.ERRORS,429)
+12 IF $DATA(ERRORS)
MERGE APPTLIST("Error","Max")=ERRORS
QUIT
+13 ;
+14 SET SDEAS=$GET(SDEASARRAY(NODE),"")
+15 NEW APPTDATA
+16 DO GETAPPTBYIEN^SDESGETAPPTWRAP4(.RETURNDATA,IEN,SDEAS)
+17 DO DECODE^XLFJSON("RETURNDATA","APPTDATA")
+18 IF $DATA(APPTDATA("Error"))
MERGE APPTLIST("Error","AppointmentIEN "_IEN)=APPTDATA("Error")
+19 IF '$DATA(APPTDATA("Error"))
MERGE APPTLIST("Appointment",SEQUENCE)=APPTDATA("Appointment")
+20 QUIT
End DoDot:1
+21 DO BUILDJSON(.APPTSLISTJSON,.APPTLIST)
+22 QUIT
BUILDJSON(APPTSLISTJSON,APPTLIST) ;Convert data to JSON
+1 NEW JSONERR
+2 SET JSONERR=""
+3 DO BUILDJSON^SDESBUILDJSON(.APPTSLISTJSON,.APPTLIST)
+4 QUIT
+5 ;