SDESPROVCLINSRCH ;ALB/BLB,BWF,JAS - SDES GET CLINICS BY PROVIDER; Aug 14, 2024@3:20pm
;;5.3;Scheduling;**837,871,887**;Aug 13, 1993;Build 7
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
GETPROVCLINICS(JSONRETURN,PROVIDERIEN) ;
N CLINICS,RETURN,ERRORS
;
I '$$VALIDATEPROVIDER(.ERRORS,$G(PROVIDERIEN)) M RETURN=ERRORS D BUILDJSON(.JSONRETURN,.RETURN) Q
;
D BUILD(.CLINICS,$G(PROVIDERIEN))
I '$D(CLINICS) S CLINICS("Provider",1)=""
;
M RETURN=CLINICS D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
Q
;
BUILD(CLINICS,PROVIDERIEN) ;
N CLINICIEN,COUNT
;
I '$D(^SC("AVADPR",PROVIDERIEN)) Q
S CLINICS("Provider",1,"ProviderName")=$$GET1^DIQ(200,PROVIDERIEN,.01,"E")
;
S CLINICIEN=0,COUNT=0
F S CLINICIEN=$O(^SC("AVADPR",PROVIDERIEN,CLINICIEN)) Q:'CLINICIEN D
.S COUNT=COUNT+1
.S CLINICS("Provider",1,"AssociatedClinicIEN",COUNT)=CLINICIEN
.S CLINICS("Provider",1,"AssociatedClinicName",COUNT)=$$GET1^DIQ(44,CLINICIEN,.01,"E")
.S CLINICS("Provider",1,"PbspID",COUNT)=$$GET1^DIQ(44,CLINICIEN,200,"E")
.S CLINICS("Provider",1,"VeteranSelfCancel",COUNT)=$$GET1^DIQ(44,CLINICIEN,63,"E")
Q
;
VALIDATEPROVIDER(ERRORS,PROVIDERIEN) ;
I PROVIDERIEN="" D ERRLOG^SDESJSON(.ERRORS,53) Q 0
I PROVIDERIEN'="",'$D(^VA(200,PROVIDERIEN,0)) D ERRLOG^SDESJSON(.ERRORS,54) Q 0
Q 1
;
BUILDJSON(JSONRETURN,RETURN) ;
N JSONERROR
D ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESPROVCLINSRCH 1454 printed Dec 13, 2024@02:57:35 Page 2
SDESPROVCLINSRCH ;ALB/BLB,BWF,JAS - SDES GET CLINICS BY PROVIDER; Aug 14, 2024@3:20pm
+1 ;;5.3;Scheduling;**837,871,887**;Aug 13, 1993;Build 7
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
GETPROVCLINICS(JSONRETURN,PROVIDERIEN) ;
+1 NEW CLINICS,RETURN,ERRORS
+2 ;
+3 IF '$$VALIDATEPROVIDER(.ERRORS,$GET(PROVIDERIEN))
MERGE RETURN=ERRORS
DO BUILDJSON(.JSONRETURN,.RETURN)
QUIT
+4 ;
+5 DO BUILD(.CLINICS,$GET(PROVIDERIEN))
+6 IF '$DATA(CLINICS)
SET CLINICS("Provider",1)=""
+7 ;
+8 MERGE RETURN=CLINICS
DO BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
+9 QUIT
+10 ;
BUILD(CLINICS,PROVIDERIEN) ;
+1 NEW CLINICIEN,COUNT
+2 ;
+3 IF '$DATA(^SC("AVADPR",PROVIDERIEN))
QUIT
+4 SET CLINICS("Provider",1,"ProviderName")=$$GET1^DIQ(200,PROVIDERIEN,.01,"E")
+5 ;
+6 SET CLINICIEN=0
SET COUNT=0
+7 FOR
SET CLINICIEN=$ORDER(^SC("AVADPR",PROVIDERIEN,CLINICIEN))
if 'CLINICIEN
QUIT
Begin DoDot:1
+8 SET COUNT=COUNT+1
+9 SET CLINICS("Provider",1,"AssociatedClinicIEN",COUNT)=CLINICIEN
+10 SET CLINICS("Provider",1,"AssociatedClinicName",COUNT)=$$GET1^DIQ(44,CLINICIEN,.01,"E")
+11 SET CLINICS("Provider",1,"PbspID",COUNT)=$$GET1^DIQ(44,CLINICIEN,200,"E")
+12 SET CLINICS("Provider",1,"VeteranSelfCancel",COUNT)=$$GET1^DIQ(44,CLINICIEN,63,"E")
End DoDot:1
+13 QUIT
+14 ;
VALIDATEPROVIDER(ERRORS,PROVIDERIEN) ;
+1 IF PROVIDERIEN=""
DO ERRLOG^SDESJSON(.ERRORS,53)
QUIT 0
+2 IF PROVIDERIEN'=""
IF '$DATA(^VA(200,PROVIDERIEN,0))
DO ERRLOG^SDESJSON(.ERRORS,54)
QUIT 0
+3 QUIT 1
+4 ;
BUILDJSON(JSONRETURN,RETURN) ;
+1 NEW JSONERROR
+2 DO ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
+3 QUIT
+4 ;