SDESSEARCH ;ALB/LAB - VISTA SCHEDULING RPCS - GIVEN SEARCH STRING, RETURN LISTS ;Jun 09,2021
;;5.3;Scheduling;**790**;Aug 13, 1993;Build 11
;;Per VHA Directive 2004-038, this routine should not be modified
Q
;
CLINICSEARCH(CLINICLIST,SEARCHSTRING) ;Given a search string return a clinic list that matches.
Q:$L(SEARCHSTRING)<2
N CLINICIEN,CLINICNAME,STRINGLENGTH,CLINICINFO,CLINICCOUNT,INACTIVEDT,REACTIVEDT
S CLINICIEN="",CLINICCOUNT=0
S STRINGLENGTH=$L(SEARCHSTRING)
S CLINICNAME=$O(^SC("B",SEARCHSTRING),-1)
I $E(CLINICNAME,1,STRINGLENGTH)=SEARCHSTRING D
. S CLINICNAME=$O(^SC("B",CLINICNAME),-1)
F S CLINICNAME=$O(^SC("B",CLINICNAME)) Q:CLINICNAME=""!($E(CLINICNAME,1,STRINGLENGTH)'=SEARCHSTRING) D
. Q:(CLINICCOUNT>49)
. S CLINICIEN=$O(^SC("B",CLINICNAME,""))
. S INACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2505,"I")
. S REACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2506,"I")
. Q:((INACTIVEDT'="")&(INACTIVEDT<=DT))&(((REACTIVEDT'="")&(REACTIVEDT>DT))!(REACTIVEDT="")) ;do not include inactive clinics
. S CLINICCOUNT=CLINICCOUNT+1
. S CLINICINFO("Clinic",CLINICCOUNT,"IEN")=CLINICIEN
. S CLINICINFO("Clinic",CLINICCOUNT,"Name")=CLINICNAME
I 'CLINICCOUNT S CLINICINFO("Clinic")=""
D ENCODE^SDESJSON(.CLINICINFO,.CLINICLIST)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESSEARCH 1268 printed Oct 16, 2024@18:58:10 Page 2
SDESSEARCH ;ALB/LAB - VISTA SCHEDULING RPCS - GIVEN SEARCH STRING, RETURN LISTS ;Jun 09,2021
+1 ;;5.3;Scheduling;**790**;Aug 13, 1993;Build 11
+2 ;;Per VHA Directive 2004-038, this routine should not be modified
+3 QUIT
+4 ;
CLINICSEARCH(CLINICLIST,SEARCHSTRING) ;Given a search string return a clinic list that matches.
+1 if $LENGTH(SEARCHSTRING)<2
QUIT
+2 NEW CLINICIEN,CLINICNAME,STRINGLENGTH,CLINICINFO,CLINICCOUNT,INACTIVEDT,REACTIVEDT
+3 SET CLINICIEN=""
SET CLINICCOUNT=0
+4 SET STRINGLENGTH=$LENGTH(SEARCHSTRING)
+5 SET CLINICNAME=$ORDER(^SC("B",SEARCHSTRING),-1)
+6 IF $EXTRACT(CLINICNAME,1,STRINGLENGTH)=SEARCHSTRING
Begin DoDot:1
+7 SET CLINICNAME=$ORDER(^SC("B",CLINICNAME),-1)
End DoDot:1
+8 FOR
SET CLINICNAME=$ORDER(^SC("B",CLINICNAME))
if CLINICNAME=""!($EXTRACT(CLINICNAME,1,STRINGLENGTH)'=SEARCHSTRING)
QUIT
Begin DoDot:1
+9 if (CLINICCOUNT>49)
QUIT
+10 SET CLINICIEN=$ORDER(^SC("B",CLINICNAME,""))
+11 SET INACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2505,"I")
+12 SET REACTIVEDT=$$GET1^DIQ(44,CLINICIEN,2506,"I")
+13 ;do not include inactive clinics
if ((INACTIVEDT'="")&(INACTIVEDT<=DT))&(((REACTIVEDT'="")&(REACTIVEDT>DT))!(REACTIVEDT=""))
QUIT
+14 SET CLINICCOUNT=CLINICCOUNT+1
+15 SET CLINICINFO("Clinic",CLINICCOUNT,"IEN")=CLINICIEN
+16 SET CLINICINFO("Clinic",CLINICCOUNT,"Name")=CLINICNAME
End DoDot:1
+17 IF 'CLINICCOUNT
SET CLINICINFO("Clinic")=""
+18 DO ENCODE^SDESJSON(.CLINICINFO,.CLINICLIST)
+19 QUIT
+20 ;