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

SDESVVC.m

Go to the documentation of this file.
  1. SDESVVC ;ALB/WTC,DJS,JAS - VISTA SCHEDULING RPCS ;DEC 23, 2022@11:25
  1. ;;5.3;Scheduling;**828,833**;Aug 13, 1993;Build 9
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. ;
  1. Q
  1. ;
  1. VVCAPPT(SDESJSON,SDESAPPT) ;
  1. ;
  1. ; SDES VVC APPT RPC
  1. ;
  1. ; Returns VVC Web app URL in JSON format if appointment is valid and for a VVC clinic.
  1. ;
  1. ; SDESAPPT = Appointment (pointer to #409.84)
  1. ;
  1. N SDESARRAY
  1. ;
  1. D ERRCHK
  1. I '$D(SDESARRAY("Error",1)) D URLCHK
  1. ;
  1. D BUILDJSON^SDESBUILDJSON(.SDESJSON,.SDESARRAY)
  1. Q
  1. ;
  1. ERRCHK ;
  1. ;
  1. ; ERROR CHECKING
  1. ;
  1. I '$L($G(SDESAPPT)) D Q
  1. . S SDESARRAY("Error",1)=$$ERRTXT(14) ; Missing Appt IEN
  1. ;
  1. I '+$G(SDESAPPT) D Q
  1. . S SDESARRAY("Error",1)=$$ERRTXT(15) ; Incorrectly formatted Appt IEN
  1. ;
  1. I '$D(^SDEC(409.84,SDESAPPT)) D Q
  1. . S SDESARRAY("Error",1)=$$ERRTXT(15) ; Appt IEN does not exist
  1. Q
  1. ;
  1. URLCHK ;
  1. ;
  1. N SDESRES,SDES44,SDESSTOP,SDESREDT
  1. ;
  1. ; Appointment's resource
  1. ;
  1. S SDESRES=$$GET1^DIQ(409.84,SDESAPPT,.07,"I")
  1. I 'SDESRES S SDESARRAY("Error",1)=$$ERRTXT(383) Q ; Resource is missing from Appt
  1. ;
  1. ; Resource's clinic
  1. ;
  1. S SDES44=$$GET1^DIQ(409.831,SDESRES,.04,"I")
  1. I 'SDES44 S SDESARRAY("Error",1)=$$ERRTXT(283) Q ; Clinic is missing from Resource
  1. ;
  1. ; Clinic's stop code and credit stop code.
  1. ;
  1. S SDESSTOP=$$GET1^DIQ(44,SDES44,8,"I"),SDESREDT=$$GET1^DIQ(44,SDES44,2503,"I")
  1. I SDESSTOP S SDESSTOP=$$GET1^DIQ(40.7,SDESSTOP,1,"I")
  1. I SDESREDT S SDESREDT=$$GET1^DIQ(40.7,SDESREDT,1,"I")
  1. ;
  1. I 'SDESSTOP,'SDESREDT S SDESARRAY("Error",1)=$$ERRTXT(98) Q ; No stop codes so no URL.
  1. ;
  1. ; If clinic's stop code or credit stop code is for VVC, return URL for VVC Web app
  1. ;
  1. I SDESSTOP'="",$O(^SDEC(409.98,1,3,"B",SDESSTOP,0))>0 D Q
  1. . S SDESARRAY(0)="T01000URL",SDESARRAY(1)=$$GET1^DIQ(409.98,1,6)
  1. I SDESREDT'="",$O(^SDEC(409.98,1,3,"B",SDESREDT,0))>0 D Q
  1. . S SDESARRAY(0)="T01000URL",SDESARRAY(1)=$$GET1^DIQ(409.98,1,6)
  1. ;
  1. ; Not a VVC appointment.
  1. ;
  1. S SDESARRAY("Error",1)=$$ERRTXT(403)
  1. ;
  1. ERRTXT(ERRNM) ;
  1. ;
  1. ; ERRNM - The ERROR CODE/NUMBER field from the SDES ERROR CODES file (#409.93)
  1. ;
  1. N SDESERR
  1. D ERRLOG^SDESJSON(.SDESERR,ERRNM)
  1. Q SDESERR("Error",1)