SDESGETCLINSIEN ;ALB/CGP/MGD,BWF - Get Clinic info by IEN list ;Dec 07, 2023@15:49
;;5.3;Scheduling;**831,864,875**;Nov 18, 2022;Build 25
;;Per VHA Directive 6402, this routine should not be modified
;
;
Q
;
CLINICLISTBYIEN(CLINLISTJSON,CLINICIENS) ;
N CLINICDATA,NODE,SEQUENCE,IEN,SDEAS,HASHFLG,RETURNDATA,CLINICLIST,ERRORS
S (CLINICDATA,NODE,IEN,SDEAS,RETURNDATA,CLINICLIST)=""
S (HASHFLG,SEQUENCE)=0
;
F S NODE=$O(CLINICIENS(NODE)) Q:NODE="" D
. N ERRORS
. S IEN=$G(CLINICIENS(NODE))
. I IEN="" D ERRLOG^SDESJSON(.ERRORS,67)
. I $D(ERRORS) M CLINICLIST("Error","Sequence "_NODE)=ERRORS Q
. S SEQUENCE=SEQUENCE+1
. I SEQUENCE>50 D ERRLOG^SDESJSON(.ERRORS,381)
. I $D(ERRORS) M CLINICLIST("Error","Max")=ERRORS("Error") Q
. ;
. K CLINICDATA,RETURNDATA
. D JSONCLNINFO^SDESRTVCLN2(.RETURNDATA,IEN,SDEAS,HASHFLG)
. D DECODE^XLFJSON("RETURNDATA","CLINICDATA")
. I $D(CLINICDATA("Error")) M CLINICLIST("Error","ClinicIEN "_IEN)=CLINICDATA("Error")
. I '$D(CLINICDATA("Error")) M CLINICLIST("Clinic",SEQUENCE)=CLINICDATA("Clinic")
. Q
D BUILDJSON(.CLINLISTJSON,.CLINICLIST)
Q
BUILDJSON(CLINLISTJSON,CLINICLIST) ;Convert data to JSON
N JSONERR
S JSONERR=""
D BUILDJSON^SDESBUILDJSON(.CLINLISTJSON,.CLINICLIST)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETCLINSIEN 1278 printed Dec 13, 2024@02:56:51 Page 2
SDESGETCLINSIEN ;ALB/CGP/MGD,BWF - Get Clinic info by IEN list ;Dec 07, 2023@15:49
+1 ;;5.3;Scheduling;**831,864,875**;Nov 18, 2022;Build 25
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ;
+5 QUIT
+6 ;
CLINICLISTBYIEN(CLINLISTJSON,CLINICIENS) ;
+1 NEW CLINICDATA,NODE,SEQUENCE,IEN,SDEAS,HASHFLG,RETURNDATA,CLINICLIST,ERRORS
+2 SET (CLINICDATA,NODE,IEN,SDEAS,RETURNDATA,CLINICLIST)=""
+3 SET (HASHFLG,SEQUENCE)=0
+4 ;
+5 FOR
SET NODE=$ORDER(CLINICIENS(NODE))
if NODE=""
QUIT
Begin DoDot:1
+6 NEW ERRORS
+7 SET IEN=$GET(CLINICIENS(NODE))
+8 IF IEN=""
DO ERRLOG^SDESJSON(.ERRORS,67)
+9 IF $DATA(ERRORS)
MERGE CLINICLIST("Error","Sequence "_NODE)=ERRORS
QUIT
+10 SET SEQUENCE=SEQUENCE+1
+11 IF SEQUENCE>50
DO ERRLOG^SDESJSON(.ERRORS,381)
+12 IF $DATA(ERRORS)
MERGE CLINICLIST("Error","Max")=ERRORS("Error")
QUIT
+13 ;
+14 KILL CLINICDATA,RETURNDATA
+15 DO JSONCLNINFO^SDESRTVCLN2(.RETURNDATA,IEN,SDEAS,HASHFLG)
+16 DO DECODE^XLFJSON("RETURNDATA","CLINICDATA")
+17 IF $DATA(CLINICDATA("Error"))
MERGE CLINICLIST("Error","ClinicIEN "_IEN)=CLINICDATA("Error")
+18 IF '$DATA(CLINICDATA("Error"))
MERGE CLINICLIST("Clinic",SEQUENCE)=CLINICDATA("Clinic")
+19 QUIT
End DoDot:1
+20 DO BUILDJSON(.CLINLISTJSON,.CLINICLIST)
+21 QUIT
BUILDJSON(CLINLISTJSON,CLINICLIST) ;Convert data to JSON
+1 NEW JSONERR
+2 SET JSONERR=""
+3 DO BUILDJSON^SDESBUILDJSON(.CLINLISTJSON,.CLINICLIST)
+4 QUIT
+5 ;