SDES2PRVCLINSRC ;ALB/TJB,JAS - VISTA SCHEDULING RPC SDES2 GET CLINICS BY PROVIDER ; Aug 13, 2024
;;5.3;Scheduling;**880,887**;Aug 13, 1993;Build 7
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
; SDINPUT("PROVIDER IEN")=# ; IEN of the provider from file #200 (Required)
; SDINPUT("INACTIVE CLINIC")=1|0 ; 1=> Send inactive and active, 0 or null => send only active (Optional)
GETPROVCLINICS(SDRETURN,SDCONTEXT,SDINPUT) ;
N CLINICS,ERRORS,VAL
;
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
I $D(ERRORS) S ERRORS("Provider",1)="" D BUILDJSON^SDES2JSON(.SDRETURN,.ERRORS) Q
D VALFILEIEN^SDES2VALUTIL(.VAL,.ERRORS,200,$G(SDINPUT("PROVIDER IEN")),1,,53,54)
D VALIDINACTIVE(.ERRORS,$G(SDINPUT("INACTIVE CLINIC")))
I $D(ERRORS) S ERRORS("Provider",1)="" D BUILDJSON^SDES2JSON(.SDRETURN,.ERRORS) Q
;
D BUILD(.CLINICS,$G(SDINPUT("PROVIDER IEN")),$S($G(SDINPUT("INACTIVE CLINIC"))=1:1,1:0))
I '$D(CLINICS) S CLINICS("Provider",1)=""
;
D BUILDJSON^SDES2JSON(.SDRETURN,.CLINICS)
Q
;
BUILD(CLINICS,PROVIDERIEN,INACTFLAG) ;
N CLINICIEN,COUNT,CLINSTATUS
;
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 CLINSTATUS=$$INACTIVE^SDES2UTIL(CLINICIEN)
. I INACTFLAG=0,CLINSTATUS'=0 Q
. 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,"AssociatedClinicStatus",COUNT)=$S(CLINSTATUS=0:"Active",1:"Inactive")
. 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
;
VALIDINACTIVE(ERRORS,FLAG) ; If SDINPUT("INACTIVE CLINIC") If sent make sure it is a 1 or 0
Q:$G(FLAG)=""
I (FLAG'=1),(FLAG'=0) D ERRLOG^SDES2JSON(.ERRORS,267)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2PRVCLINSRC 2033 printed Oct 16, 2024@18:54:57 Page 2
SDES2PRVCLINSRC ;ALB/TJB,JAS - VISTA SCHEDULING RPC SDES2 GET CLINICS BY PROVIDER ; Aug 13, 2024
+1 ;;5.3;Scheduling;**880,887**;Aug 13, 1993;Build 7
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
+6 ; SDINPUT("PROVIDER IEN")=# ; IEN of the provider from file #200 (Required)
+7 ; SDINPUT("INACTIVE CLINIC")=1|0 ; 1=> Send inactive and active, 0 or null => send only active (Optional)
GETPROVCLINICS(SDRETURN,SDCONTEXT,SDINPUT) ;
+1 NEW CLINICS,ERRORS,VAL
+2 ;
+3 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+4 IF $DATA(ERRORS)
SET ERRORS("Provider",1)=""
DO BUILDJSON^SDES2JSON(.SDRETURN,.ERRORS)
QUIT
+5 DO VALFILEIEN^SDES2VALUTIL(.VAL,.ERRORS,200,$GET(SDINPUT("PROVIDER IEN")),1,,53,54)
+6 DO VALIDINACTIVE(.ERRORS,$GET(SDINPUT("INACTIVE CLINIC")))
+7 IF $DATA(ERRORS)
SET ERRORS("Provider",1)=""
DO BUILDJSON^SDES2JSON(.SDRETURN,.ERRORS)
QUIT
+8 ;
+9 DO BUILD(.CLINICS,$GET(SDINPUT("PROVIDER IEN")),$SELECT($GET(SDINPUT("INACTIVE CLINIC"))=1:1,1:0))
+10 IF '$DATA(CLINICS)
SET CLINICS("Provider",1)=""
+11 ;
+12 DO BUILDJSON^SDES2JSON(.SDRETURN,.CLINICS)
+13 QUIT
+14 ;
BUILD(CLINICS,PROVIDERIEN,INACTFLAG) ;
+1 NEW CLINICIEN,COUNT,CLINSTATUS
+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 CLINSTATUS=$$INACTIVE^SDES2UTIL(CLINICIEN)
+9 IF INACTFLAG=0
IF CLINSTATUS'=0
QUIT
+10 SET COUNT=COUNT+1
+11 SET CLINICS("Provider",1,"AssociatedClinicIEN",COUNT)=CLINICIEN
+12 SET CLINICS("Provider",1,"AssociatedClinicName",COUNT)=$$GET1^DIQ(44,CLINICIEN,.01,"E")
+13 SET CLINICS("Provider",1,"AssociatedClinicStatus",COUNT)=$SELECT(CLINSTATUS=0:"Active",1:"Inactive")
+14 SET CLINICS("Provider",1,"PbspID",COUNT)=$$GET1^DIQ(44,CLINICIEN,200,"E")
+15 SET CLINICS("Provider",1,"VeteranSelfCancel",COUNT)=$$GET1^DIQ(44,CLINICIEN,63,"E")
End DoDot:1
+16 QUIT
+17 ;
VALIDINACTIVE(ERRORS,FLAG) ; If SDINPUT("INACTIVE CLINIC") If sent make sure it is a 1 or 0
+1 if $GET(FLAG)=""
QUIT
+2 IF (FLAG'=1)
IF (FLAG'=0)
DO ERRLOG^SDES2JSON(.ERRORS,267)
+3 QUIT
+4 ;