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

SDESRECCLINSRCH.m

Go to the documentation of this file.
  1. SDESRECCLINSRCH ;ALB/MGD - VISTA SCHEDULING RECALL CLINIC SEARCH RPC; Aug 24, 2022@15:04
  1. ;;5.3;Scheduling;**823**;Aug 13, 1993;Build 9
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. ;
  1. Q
  1. ; RPC = SDES SEARCH RECALL CLINICS
  1. SEARCHRECALLCLIN(JSONRETURN,SEARCHSTRING) ;Search for Recall clinics and provide return of matches in JSON STRING
  1. ; INPUT - SEARCHSTRING = free text string that represents the recall clinic name that will be searched
  1. ; OUTPUT - JSONRETURN
  1. ; List of Recall Clinics from the RECALL REMINDERS (#403.5) file with the following data.
  1. ; Field List:
  1. ; (1) Recall Clinic IEN
  1. ; (2) Recall Clinic Name
  1. ; (3) Recall Reminder IEN
  1. ;
  1. N CLINICLIST,ERROREXISTS,ERRORLIST,CLINICRETURN,CLINICLIST
  1. K JSONRETURN
  1. S SEARCHSTRING=$G(SEARCHSTRING)
  1. S ERROREXISTS=0
  1. S ERROREXISTS=$$VALIDATEINPUT(.ERRORLIST,SEARCHSTRING)
  1. I ERROREXISTS D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.ERRORLIST) Q
  1. D GETPROVLIST(SEARCHSTRING,.CLINICLIST)
  1. D BUILDRETURN(.CLINICLIST,.CLINICRETURN)
  1. D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.CLINICRETURN)
  1. Q
  1. ;
  1. VALIDATEINPUT(ERRORLIST,SEARCHSTRING) ; validate incoming parameters
  1. ; input - ERRORLIST = passed in by reference, represents the errors that could be generated when validating the searchstring
  1. ; SEARCHSTRING = represents the name or partial name of the Recall Clinic
  1. ; returns 0 or 1
  1. ; 0 = no validation errors
  1. ; 1 = validation errors
  1. S SEARCHSTRING=$TR(SEARCHSTRING,$C(13)_$C(10)_$C(9),"")
  1. I ($L(SEARCHSTRING)<3)!($L(SEARCHSTRING)>35) D Q 1
  1. . D ERRLOG^SDESJSON(.ERRORLIST,230)
  1. . S ERRORLIST("Recall Clinic",1)=""
  1. Q 0
  1. ;
  1. GETPROVLIST(SEARCHSTRING,CLINICLIST) ; pull matching recall clinics using the first input parameter passed in by the RPC
  1. ; Input - SEARCHSTRING = string that represents the name of the recall clinic
  1. ; CLINICLIST = passed in by reference; represents the array that will be returned as output
  1. ; Output - CLINICLIST = list of recall clinic names, clinic IENs and the associated recall reminder IENs.
  1. N RESULTS,SUB3
  1. K CLINICLIST
  1. S SUB3=0
  1. D FIND^DIC(403.5,,"@;4.5",,SEARCHSTRING,,"E",,,"RESULTS")
  1. F S SUB3=$O(RESULTS("DILIST",2,SUB3)) Q:SUB3="" D
  1. . S CLINNAME=$G(RESULTS("DILIST","ID",SUB3,4.5))
  1. . S CLINICLIST(CLINNAME,SUB3)=$G(RESULTS("DILIST",2,SUB3))
  1. Q
  1. ;
  1. BUILDRETURN(CLINICLIST,CLINICRETURN) ;Build return array with recall reminder clinic data
  1. ; input - CLINICLIST = array of recall clinics
  1. ; CLINICRETURN = passed by reference, represents the array of recall clinics and associated data that will be returned to the client
  1. ; output - CLINICRETURN = recall clinic array and their associated data to be sent back to the client
  1. ;
  1. N CLINIEN,CLINNAME,RECIEN,RECCNT
  1. S (CLINNAME,RECCNT)=0
  1. F S CLINNAME=$O(CLINICLIST(CLINNAME)) Q:CLINNAME="" D
  1. . S CLINIEN=$$FIND1^DIC(44,"","X",CLINNAME,"B","","ERROR")
  1. . Q:'CLINIEN
  1. . S RECIEN=0
  1. . F S RECIEN=$O(CLINICLIST(CLINNAME,RECIEN)) Q:'RECIEN D
  1. . . S CLINICRETURN("Recall Clinic",CLINNAME,RECIEN,"ClinicIEN")=CLINIEN
  1. . . S CLINICRETURN("Recall Clinic",CLINNAME,RECIEN,"ClinicName")=CLINNAME
  1. . . S CLINICRETURN("Recall Clinic",CLINNAME,RECIEN,"ClinicRecallIEN")=RECIEN
  1. . . S RECCNT=RECCNT+1
  1. I RECCNT=0 S CLINICRETURN("Recall Clinic",1)=""
  1. Q