SDESVVSJSON ;ALB/TAW,DJS - Get Patient, Provider and System Info to make VVS call ; NOV 9,2022@11:25
;;5.3;Scheduling;**828**;Aug 13, 1993;Build 8
;;Per VHA Directive 6402, this routine should not be modified
;
; Documented API's and Integration Agreements
; -------------------------------------------
; Reference to $$GETS^DIQ,$$GETS1^DIQ in ICR #2056
Q
;
GETVVSMAKEINFO(SDVVSJSON,PATIENTIEN,CLINICIEN,APPTDTTM) ;GET INFO TO MAKE A VIDEO VISIT WEB SERVICE (VVS) CALL
;INPUT:
; PATIENTIEN (Patient IEN)
; CLINICIEN (Clinic IEN)
; APPTDTTM - Appointment date and time external format
;
;RETURN PARMETER:
; Field List:
; (1) Patient Info
; (2) Default Provider Info
; (3) System Info
;
N SDVVSREC,ERRPOP,ERR,ERRMSG,SDESI,VVSPATIENT,VVSPROVIDER,PROVIDERINFO,VVSSYSTEMINFO
D INIT
D VALIDATE
I ERRPOP D BLDJSON Q
D BLDVVSREC
D BLDJSON
;
K PATINFO,PROVIDERIEN,PROVIDERINFO,VVSSYSTEMINFO
Q
;
INIT ; initialize values needed
S SDESI=0
S SDESI=$G(SDESI,0),ERR=""
S (VVSPATIENT,VVSPROVIDER,PROVIDERINFO,VVSSYSTEMINFO)=""
S ERRPOP=0,SDESI=0,ERRMSG=""
Q
;
VALIDATE ; validate incoming parameters
I PATIENTIEN="" D
. ;create error message - Patient IEN cannot be blank
. D ERRLOG^SDESJSON(.SDVVSREC,66)
. S ERRPOP=1
I CLINICIEN="" D
. ;create error message - Clinic IEN cannot be blank
. D ERRLOG^SDESJSON(.SDVVSREC,67)
. S ERRPOP=1
I APPTDTTM="" S ERRPOP=1 D ERRLOG^SDESJSON(.SDVVSREC,76)
I APPTDTTM'="" D
.S APPTDTTM=$$NETTOFM^SDECDATE(APPTDTTM)
.I APPTDTTM=-1 S ERRPOP=1 D ERRLOG^SDESJSON(.SDVVSREC,77)
Q
;
BLDJSON ;
D ENCODE^SDESJSON(.SDVVSREC,.SDVVSJSON,.ERR)
K SDVVSREC
Q
;
BLDVVSREC ;Build VVS info
;
S SDVVSREC("VVSMakeInfo","Appointment","ApptDtTm")=$$FMTISO^SDAMUTDT(APPTDTTM,CLINICIEN)
S VVSPATIENT=""
D GETVVSPATIENT^SDECVVS(.VVSPATIENT,PATIENTIEN)
I VVSPATIENT'="" D
.S SDESI=1
.S SDVVSREC("VVSMakeInfo","Patient","IEN")=$P(VVSPATIENT,"^",1)
.S SDVVSREC("VVSMakeInfo","Patient","DateOfBirth")=$P(VVSPATIENT,"^",2)
.S SDVVSREC("VVSMakeInfo","Patient","FirstName")=$P(VVSPATIENT,"^",3)
.S SDVVSREC("VVSMakeInfo","Patient","LastName")=$P(VVSPATIENT,"^",4)
.S SDVVSREC("VVSMakeInfo","Patient","SSN")=$P(VVSPATIENT,"^",5)
.S SDVVSREC("VVSMakeInfo","Patient","Email")=$P(VVSPATIENT,"^",6)
.S SDVVSREC("VVSMakeInfo","Patient","HomePhone")=$P(VVSPATIENT,"^",7)
.S SDVVSREC("VVSMakeInfo","Patient","CellPhone")=$P(VVSPATIENT,"^",8)
.S SDVVSREC("VVSMakeInfo","Patient","ICN")=$P(VVSPATIENT,"^",9)
.S SDVVSREC("VVSMakeInfo","Patient","ZipCode")=$P(VVSPATIENT,"^",10)
D GETDPROIEN^SDECVVS(.PROVIDERIEN,CLINICIEN)
D GETPROINFO^SDECVVS(.PROVIDERINFO,PROVIDERIEN)
I PROVIDERINFO'="" D
.S SDESI=1
.S SDVVSREC("VVSMakeInfo","Provider","IEN")=$P(PROVIDERINFO,"^",1)
.S SDVVSREC("VVSMakeInfo","Provider","Name")=$P(PROVIDERINFO,"^",2)
.S SDVVSREC("VVSMakeInfo","Provider","Email")=$P(PROVIDERINFO,"^",3)
.S SDVVSREC("VVSMakeInfo","Provider","Cell")=$P(PROVIDERINFO,"^",4)
D GETSYSTEMINFO^SDECVVS(.VVSSYSTEMINFO,CLINICIEN)
I VVSSYSTEMINFO'="" D
.S SDESI=1
.S SDVVSREC("VVSMakeInfo","SystemInfo","StationID")=$P(VVSSYSTEMINFO,"^",1)
.S SDVVSREC("VVSMakeInfo","SystemInfo","FacilityName")=$P(VVSSYSTEMINFO,"^",2)
.S SDVVSREC("VVSMakeInfo","SystemInfo","TimeZone")=$P(VVSSYSTEMINFO,"^",3)
.S SDVVSREC("VVSMakeInfo","SystemInfo","TimeZoneException")=$P(VVSSYSTEMINFO,"^",4)
.S SDVVSREC("VVSMakeInfo","SystemInfo","Offset")=$P(VVSSYSTEMINFO,"^",5)
.S SDVVSREC("VVSMakeInfo","SystemInfo","OffsetDST")=$P(VVSSYSTEMINFO,"^",6)
I '$D(SDVVSREC("VVSMakeInfo")) S SDVVSREC("VVSMakeInfo")=""
;
I SDESI=0 D
. ;create error message - No VVS info found
. D ERRLOG^SDESJSON(.SDVVSREC,68)
. S ERRPOP=1
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESVVSJSON 3763 printed Nov 22, 2024@18:07:48 Page 2
SDESVVSJSON ;ALB/TAW,DJS - Get Patient, Provider and System Info to make VVS call ; NOV 9,2022@11:25
+1 ;;5.3;Scheduling;**828**;Aug 13, 1993;Build 8
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ; Documented API's and Integration Agreements
+5 ; -------------------------------------------
+6 ; Reference to $$GETS^DIQ,$$GETS1^DIQ in ICR #2056
+7 QUIT
+8 ;
GETVVSMAKEINFO(SDVVSJSON,PATIENTIEN,CLINICIEN,APPTDTTM) ;GET INFO TO MAKE A VIDEO VISIT WEB SERVICE (VVS) CALL
+1 ;INPUT:
+2 ; PATIENTIEN (Patient IEN)
+3 ; CLINICIEN (Clinic IEN)
+4 ; APPTDTTM - Appointment date and time external format
+5 ;
+6 ;RETURN PARMETER:
+7 ; Field List:
+8 ; (1) Patient Info
+9 ; (2) Default Provider Info
+10 ; (3) System Info
+11 ;
+12 NEW SDVVSREC,ERRPOP,ERR,ERRMSG,SDESI,VVSPATIENT,VVSPROVIDER,PROVIDERINFO,VVSSYSTEMINFO
+13 DO INIT
+14 DO VALIDATE
+15 IF ERRPOP
DO BLDJSON
QUIT
+16 DO BLDVVSREC
+17 DO BLDJSON
+18 ;
+19 KILL PATINFO,PROVIDERIEN,PROVIDERINFO,VVSSYSTEMINFO
+20 QUIT
+21 ;
INIT ; initialize values needed
+1 SET SDESI=0
+2 SET SDESI=$GET(SDESI,0)
SET ERR=""
+3 SET (VVSPATIENT,VVSPROVIDER,PROVIDERINFO,VVSSYSTEMINFO)=""
+4 SET ERRPOP=0
SET SDESI=0
SET ERRMSG=""
+5 QUIT
+6 ;
VALIDATE ; validate incoming parameters
+1 IF PATIENTIEN=""
Begin DoDot:1
+2 ;create error message - Patient IEN cannot be blank
+3 DO ERRLOG^SDESJSON(.SDVVSREC,66)
+4 SET ERRPOP=1
End DoDot:1
+5 IF CLINICIEN=""
Begin DoDot:1
+6 ;create error message - Clinic IEN cannot be blank
+7 DO ERRLOG^SDESJSON(.SDVVSREC,67)
+8 SET ERRPOP=1
End DoDot:1
+9 IF APPTDTTM=""
SET ERRPOP=1
DO ERRLOG^SDESJSON(.SDVVSREC,76)
+10 IF APPTDTTM'=""
Begin DoDot:1
+11 SET APPTDTTM=$$NETTOFM^SDECDATE(APPTDTTM)
+12 IF APPTDTTM=-1
SET ERRPOP=1
DO ERRLOG^SDESJSON(.SDVVSREC,77)
End DoDot:1
+13 QUIT
+14 ;
BLDJSON ;
+1 DO ENCODE^SDESJSON(.SDVVSREC,.SDVVSJSON,.ERR)
+2 KILL SDVVSREC
+3 QUIT
+4 ;
BLDVVSREC ;Build VVS info
+1 ;
+2 SET SDVVSREC("VVSMakeInfo","Appointment","ApptDtTm")=$$FMTISO^SDAMUTDT(APPTDTTM,CLINICIEN)
+3 SET VVSPATIENT=""
+4 DO GETVVSPATIENT^SDECVVS(.VVSPATIENT,PATIENTIEN)
+5 IF VVSPATIENT'=""
Begin DoDot:1
+6 SET SDESI=1
+7 SET SDVVSREC("VVSMakeInfo","Patient","IEN")=$PIECE(VVSPATIENT,"^",1)
+8 SET SDVVSREC("VVSMakeInfo","Patient","DateOfBirth")=$PIECE(VVSPATIENT,"^",2)
+9 SET SDVVSREC("VVSMakeInfo","Patient","FirstName")=$PIECE(VVSPATIENT,"^",3)
+10 SET SDVVSREC("VVSMakeInfo","Patient","LastName")=$PIECE(VVSPATIENT,"^",4)
+11 SET SDVVSREC("VVSMakeInfo","Patient","SSN")=$PIECE(VVSPATIENT,"^",5)
+12 SET SDVVSREC("VVSMakeInfo","Patient","Email")=$PIECE(VVSPATIENT,"^",6)
+13 SET SDVVSREC("VVSMakeInfo","Patient","HomePhone")=$PIECE(VVSPATIENT,"^",7)
+14 SET SDVVSREC("VVSMakeInfo","Patient","CellPhone")=$PIECE(VVSPATIENT,"^",8)
+15 SET SDVVSREC("VVSMakeInfo","Patient","ICN")=$PIECE(VVSPATIENT,"^",9)
+16 SET SDVVSREC("VVSMakeInfo","Patient","ZipCode")=$PIECE(VVSPATIENT,"^",10)
End DoDot:1
+17 DO GETDPROIEN^SDECVVS(.PROVIDERIEN,CLINICIEN)
+18 DO GETPROINFO^SDECVVS(.PROVIDERINFO,PROVIDERIEN)
+19 IF PROVIDERINFO'=""
Begin DoDot:1
+20 SET SDESI=1
+21 SET SDVVSREC("VVSMakeInfo","Provider","IEN")=$PIECE(PROVIDERINFO,"^",1)
+22 SET SDVVSREC("VVSMakeInfo","Provider","Name")=$PIECE(PROVIDERINFO,"^",2)
+23 SET SDVVSREC("VVSMakeInfo","Provider","Email")=$PIECE(PROVIDERINFO,"^",3)
+24 SET SDVVSREC("VVSMakeInfo","Provider","Cell")=$PIECE(PROVIDERINFO,"^",4)
End DoDot:1
+25 DO GETSYSTEMINFO^SDECVVS(.VVSSYSTEMINFO,CLINICIEN)
+26 IF VVSSYSTEMINFO'=""
Begin DoDot:1
+27 SET SDESI=1
+28 SET SDVVSREC("VVSMakeInfo","SystemInfo","StationID")=$PIECE(VVSSYSTEMINFO,"^",1)
+29 SET SDVVSREC("VVSMakeInfo","SystemInfo","FacilityName")=$PIECE(VVSSYSTEMINFO,"^",2)
+30 SET SDVVSREC("VVSMakeInfo","SystemInfo","TimeZone")=$PIECE(VVSSYSTEMINFO,"^",3)
+31 SET SDVVSREC("VVSMakeInfo","SystemInfo","TimeZoneException")=$PIECE(VVSSYSTEMINFO,"^",4)
+32 SET SDVVSREC("VVSMakeInfo","SystemInfo","Offset")=$PIECE(VVSSYSTEMINFO,"^",5)
+33 SET SDVVSREC("VVSMakeInfo","SystemInfo","OffsetDST")=$PIECE(VVSSYSTEMINFO,"^",6)
End DoDot:1
+34 IF '$DATA(SDVVSREC("VVSMakeInfo"))
SET SDVVSREC("VVSMakeInfo")=""
+35 ;
+36 IF SDESI=0
Begin DoDot:1
+37 ;create error message - No VVS info found
+38 DO ERRLOG^SDESJSON(.SDVVSREC,68)
+39 SET ERRPOP=1
End DoDot:1
+40 QUIT
+41 ;