Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDESPROVCLINSRCH

SDESPROVCLINSRCH.m

Go to the documentation of this file.
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
 ;