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

SDECPRVSRCHJSON.m

Go to the documentation of this file.
  1. SDECPRVSRCHJSON ;ALB/LAB,TAW - Get Providers based on Search String ;DEC 17, 2021
  1. ;;5.3;Scheduling;**797,800,804**;Aug 13, 1993;Build 9
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. ;
  1. ; Documented API's and Integration Agreements
  1. ; -------------------------------------------
  1. ;Reference to $$GETS^DIQ,$$GETS1^DIQ in ICR #2056
  1. Q
  1. ;
  1. JSONPRVLIST(SDPRVJSON,SDSRCHSTR) ;Search PROVIDERS and get data needed to make VIDEO VISIT SERVICE (VVS) Appointment
  1. ;INPUT - SDSRCHSTR (Search String)
  1. ;RETURN PARMETER:
  1. ; List of Providers from NEW PERSON (#200) File. Data is delimited by carat (^).
  1. ; Field List:
  1. ; (1) Provider Name
  1. ; (2) Provider IEN
  1. ; (3) Primary Phone
  1. ; (4) Email Address
  1. ; (5) Title
  1. ; (6) Provider Class
  1. ;
  1. N PROVIDERNAME,STRINGLENGTH,SDPRVSREC,ERRPOP,ERR,ERRMSG,SDECI
  1. D INIT
  1. D VALIDATE
  1. I ERRPOP D BLDJSON Q
  1. D BLDPRVREC
  1. D BLDJSON
  1. Q
  1. ;
  1. INIT ; initialize values needed
  1. S SDECI=0
  1. S SDECI=$G(SDECI,0),ERR=""
  1. S STRINGLENGTH=$L(SDSRCHSTR)
  1. S PROVIDERNAME=$O(^VA(200,"B",SDSRCHSTR),-1)
  1. I $E(PROVIDERNAME,1,SDSRCHSTR)=SDSRCHSTR D
  1. .S PROVIDERNAME=$O(^VA(200,"B",PROVIDERNAME),-1)
  1. S ERRPOP=0,SDECI=0,ERRMSG=""
  1. Q
  1. ;
  1. VALIDATE ; validate incoming parameters
  1. I $L(SDSRCHSTR)<2 D
  1. . ;create error message - Search String must be at least 2 characters
  1. . D ERRLOG^SDESJSON(.SDPRVSREC,64)
  1. . S ERRPOP=1
  1. Q
  1. ;
  1. BLDJSON ;
  1. D ENCODE^SDESJSON(.SDPRVSREC,.SDPRVJSON,.ERR)
  1. K SDPRVSREC
  1. Q
  1. ;
  1. BLDPRVREC ;Build a list of Providers
  1. ;
  1. N VVSPROVIDER,PROVIDERIEN,TERMDATE,SDPOP
  1. F S PROVIDERNAME=$O(^VA(200,"B",PROVIDERNAME)) Q:PROVIDERNAME=""!($E(PROVIDERNAME,1,STRINGLENGTH)'=SDSRCHSTR) D
  1. .I SDECI>49 Q
  1. .S (VVSPROVIDER,PROVIDERIEN)=""
  1. .F S PROVIDERIEN=$O(^VA(200,"B",PROVIDERNAME,PROVIDERIEN)) Q:PROVIDERIEN="" D
  1. ..S TERMDATE=$$GET1^DIQ(200,PROVIDERIEN,9.2,"I")
  1. ..S SDPOP=0
  1. ..I TERMDATE'="" D
  1. ... S:TERMDATE<DT SDPOP=1
  1. ..I ($$GET1^DIQ(200,PROVIDERIEN,7,"I")'=1)&('SDPOP) D
  1. ...D GETPROINFO^SDECVVS(.VVSPROVIDER,PROVIDERIEN)
  1. ...I VVSPROVIDER'="" D
  1. ....S SDECI=SDECI+1
  1. ....S SDPRVSREC("Provider",SDECI,"IEN")=$P(VVSPROVIDER,"^",1)
  1. ....S SDPRVSREC("Provider",SDECI,"Name")=$P(VVSPROVIDER,"^",2)
  1. ....S SDPRVSREC("Provider",SDECI,"Email")=$P(VVSPROVIDER,"^",3)
  1. ....S SDPRVSREC("Provider",SDECI,"Cell")=$P(VVSPROVIDER,"^",4)
  1. ....S SDPRVSREC("Provider",SDECI,"Title")=$P(VVSPROVIDER,"^",5)
  1. ....S SDPRVSREC("Provider",SDECI,"ProviderClass")=$P(VVSPROVIDER,"^",6)
  1. I '$D(SDPRVSREC("Provider")) S SDPRVSREC("Provider")=""
  1. I SDECI=0 D
  1. . ;create error message - No Providers found that match Search String
  1. . D ERRLOG^SDESJSON(.SDPRVSREC,65)
  1. . S ERRPOP=1
  1. Q
  1. ;