SDESGREQSIENS ;ALB/ANU,LAB - Get Appt Reqs by IEN list ;JUN 21, 2023@15:35
;;5.3;Scheduling;**845,847**;Aug 13, 1993;Build 4
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;Cloned from SDESGETREQSIEN
APPTREQSBYIEN(APPTREQSJSON,EASAUDITID,REQIENS,EASNUMS) ;
N EAS,REQUESTIEN,NODE,REQUEST,SEQUENCE,ERRORS,APPTLIST,SDESCNT
S (EAS,REQUESTIEN,NODE,REQUEST)=""
S SEQUENCE=0,EASAUDITID=$G(EASAUDITID)
;
F S NODE=$O(REQIENS(NODE)) Q:NODE="" D
. N ISREQIENVALID,ISEASVALID,SDESERR
. S (ISREQIENVALID,ISEASVALID,SDESERR)=""
. S SEQUENCE=SEQUENCE+1
. I SEQUENCE>50 D ERRLOG^SDESJSON(.ERRORS,381) S SDESERR="Y" Q
. S REQUESTIEN=$G(REQIENS(NODE)),EAS=$G(EASNUMS(NODE))
. S ISREQIENVALID=$$VALIDATEREQIEN^SDESGETAPPTREQ2(.ERRORS,$G(REQUESTIEN))
. S ISEASVALID=$$VALIDATEEAS^SDESGETAPPTREQ2(.ERRORS,$G(EAS))
. I (ISREQIENVALID=0)!(ISEASVALID=0)!(SDESERR="Y") D
. . S SDESCNT=$O(ERRORS("Error",""),-1)
. . S ERRORS("Error",SDESCNT)=ERRORS("Error",SDESCNT)_" IEN:"_$G(REQUESTIEN)
. . S SDESERR="Y"
. I SDESERR'="Y" D GETREQUEST^SDESGETAPPTREQ(.REQUEST,REQUESTIEN)
I $D(REQUEST) M APPTLIST=REQUEST
I $D(ERRORS) M APPTLIST=ERRORS
D BUILDJSON(.APPTREQSJSON,.APPTLIST)
Q
;
BUILDJSON(APPTLISTJSON,APPTLISTARRAY) ;Convert data to JSON
N JSONERR
S JSONERR=""
D ENCODE^SDESJSON(.APPTLISTARRAY,.APPTLISTJSON,.JSONERR)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGREQSIENS 1381 printed Dec 13, 2024@02:57:14 Page 2
SDESGREQSIENS ;ALB/ANU,LAB - Get Appt Reqs by IEN list ;JUN 21, 2023@15:35
+1 ;;5.3;Scheduling;**845,847**;Aug 13, 1993;Build 4
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;Cloned from SDESGETREQSIEN
APPTREQSBYIEN(APPTREQSJSON,EASAUDITID,REQIENS,EASNUMS) ;
+1 NEW EAS,REQUESTIEN,NODE,REQUEST,SEQUENCE,ERRORS,APPTLIST,SDESCNT
+2 SET (EAS,REQUESTIEN,NODE,REQUEST)=""
+3 SET SEQUENCE=0
SET EASAUDITID=$GET(EASAUDITID)
+4 ;
+5 FOR
SET NODE=$ORDER(REQIENS(NODE))
if NODE=""
QUIT
Begin DoDot:1
+6 NEW ISREQIENVALID,ISEASVALID,SDESERR
+7 SET (ISREQIENVALID,ISEASVALID,SDESERR)=""
+8 SET SEQUENCE=SEQUENCE+1
+9 IF SEQUENCE>50
DO ERRLOG^SDESJSON(.ERRORS,381)
SET SDESERR="Y"
QUIT
+10 SET REQUESTIEN=$GET(REQIENS(NODE))
SET EAS=$GET(EASNUMS(NODE))
+11 SET ISREQIENVALID=$$VALIDATEREQIEN^SDESGETAPPTREQ2(.ERRORS,$GET(REQUESTIEN))
+12 SET ISEASVALID=$$VALIDATEEAS^SDESGETAPPTREQ2(.ERRORS,$GET(EAS))
+13 IF (ISREQIENVALID=0)!(ISEASVALID=0)!(SDESERR="Y")
Begin DoDot:2
+14 SET SDESCNT=$ORDER(ERRORS("Error",""),-1)
+15 SET ERRORS("Error",SDESCNT)=ERRORS("Error",SDESCNT)_" IEN:"_$GET(REQUESTIEN)
+16 SET SDESERR="Y"
End DoDot:2
+17 IF SDESERR'="Y"
DO GETREQUEST^SDESGETAPPTREQ(.REQUEST,REQUESTIEN)
End DoDot:1
+18 IF $DATA(REQUEST)
MERGE APPTLIST=REQUEST
+19 IF $DATA(ERRORS)
MERGE APPTLIST=ERRORS
+20 DO BUILDJSON(.APPTREQSJSON,.APPTLIST)
+21 QUIT
+22 ;
BUILDJSON(APPTLISTJSON,APPTLISTARRAY) ;Convert data to JSON
+1 NEW JSONERR
+2 SET JSONERR=""
+3 DO ENCODE^SDESJSON(.APPTLISTARRAY,.APPTLISTJSON,.JSONERR)
+4 QUIT