DGREGEEWS ;ALB/MCF - E&E Web Service ;9 September 2020 9:00 AM
;;5.3;Registration;**1027,1095**;Aug 13, 1993;Build 23
;
; Subscribed ICR:
; Reference to routine XOBWLIB in ICR #5421 - Public APIs for HWSC
; Reference to UNWIND^%ZTER in ICR #1621 - Standard Error Trapping
; Reference to Web Service File XOBW(18.02 in ICR #7190
; Reference to Web Server File XOBW(18.12 in ICR #7191
;
; SAC EXEMPTION 20210107-01 : Use of vendor specific code
;
Q
EN(DGKEY,DGREQNAM,DGENSTAT,DGWSHTOE,DGCOMP) ; Main entry point function call
; Input : DGKEY (Required) - patient full ICN with checksum -> ICN_"V"_CHECKSUM
; DGREQNAM (Required) - Requester name. Ex: "VistAData"
; Output: DGENSTAT (Pass by reference) - Contains the enrollment status. NULL = ICN is unknown to ES
; DGWSHTOE (Pass by reference) - Contains the "Do You Wish To Enroll?" value.
; DGCOMP (Pass by reference) - Contains the "COMPACT Act Eligible?" value.
; Return: DGRESP - the response in the format "N^Descriptive text".
; 1 - An enrollment status exists. Descriptive text=Enrollment Status
; 0 - No enrollment status exists OR Invalid ICN OR Network error.
;
N DGEEOBJ,DGSUMMARY,DGSTCODE,DGRESP
N $ETRAP,$ESTACK
; set error trap
S $ETRAP="DO ERR^DGREGEEWS"
S (DGENSTAT,DGWSHTOE,DGSTCODE,DGCOMP)=""
S DGRESP="0^Unknown error"
D GETSUMM(.DGSUMMARY)
I '$GET(DGSUMMARY) Q DGRESP
D RESULTS(.DGSUMMARY)
Q DGRESP
;
GETSUMM(DGSUMMARY) ; Set up web service object through HWSC.
; Output: DGSUMMARY object
I '$$FIND1^DIC(18.12,,"B","DG EE SUMMARY SERVER")!'$$FIND1^DIC(18.02,,"B","DG EE SUMMARY SERVICE") S DGRESP="0^Web services are not set up" Q
S DGEEOBJ=$$GETPROXY^XOBWLIB("DG EE SUMMARY SERVICE","DG EE SUMMARY SERVER")
S DGEEOBJ.Password=DGEEOBJ.HttpPassword ; set passwords to force creation of security headers
S DGEEOBJ.HttpPassword=""
S DGEEOBJ.Username=DGEEOBJ.HttpUsername
S DGEEOBJ.HttpUsername=""
; If ICN is valid a DGSUMMARY object will be returned
; If ICN is invalid a 500 error msg will be returned with a <ZSOAP> error & gracefully exit via ERR tag.
D DGEEOBJ.getEESummary(DGKEY,"",DGREQNAM,"",.DGSUMMARY) ; get summary data
Q
RESULTS(DGSUMMARY) ; get enrollment status and "do you wish to enroll value?"
; Input: DGSUMMARY object
D STATCODE
I $ISO(DGSUMMARY.enrollmentDeterminationInfo) D Q
. S DGRESP="1^"_DGSTCODE_" Valid ICN and known to ES"
. S DGENSTAT=DGSUMMARY.enrollmentDeterminationInfo.enrollmentStatus
. S DGWSHTOE=DGSUMMARY.enrollmentDeterminationInfo.registrationInfo.doYouWishToEnroll
. S DGCOMP=DGSUMMARY.enrollmentDeterminationInfo.compactActIndicator
E D
. S DGRESP="0^"_DGSTCODE_" Valid ICN but UNKNOWN to ES"
Q
STATCODE ; http response status code
S DGSTCODE=DGEEOBJ.HttpResponse.StatusCode
Q
ERR ; error trapping code
N $ETRAP,$ESTACK,DGERR,DGTEXT
; if there's an error in the error handler just quit.
S $ETRAP="DO QUIT^DGREGEEWS"
S DGERR=$$EOFAC^XOBWLIB()
D STATCODE
S DGTEXT="Error has been logged in error log"
S DGTEXT=$S($ISO(DGEEOBJ.SoapFault):DGEEOBJ.SoapFault.faultstring,1:DGTEXT)
S DGRESP="0^"_DGSTCODE_" "_DGTEXT
; if code is not 6248 PERSON_NOT_FOUND it is some other error. Log it.
I DGERR.code'=6248 D ZTER^XOBWLIB(DGERR)
S $ECODE=""
D UNWIND^%ZTER
Q
QUIT ;
D ZTER^XOBWLIB(DGERR)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGREGEEWS 3398 printed Oct 16, 2024@18:55:34 Page 2
DGREGEEWS ;ALB/MCF - E&E Web Service ;9 September 2020 9:00 AM
+1 ;;5.3;Registration;**1027,1095**;Aug 13, 1993;Build 23
+2 ;
+3 ; Subscribed ICR:
+4 ; Reference to routine XOBWLIB in ICR #5421 - Public APIs for HWSC
+5 ; Reference to UNWIND^%ZTER in ICR #1621 - Standard Error Trapping
+6 ; Reference to Web Service File XOBW(18.02 in ICR #7190
+7 ; Reference to Web Server File XOBW(18.12 in ICR #7191
+8 ;
+9 ; SAC EXEMPTION 20210107-01 : Use of vendor specific code
+10 ;
+11 QUIT
EN(DGKEY,DGREQNAM,DGENSTAT,DGWSHTOE,DGCOMP) ; Main entry point function call
+1 ; Input : DGKEY (Required) - patient full ICN with checksum -> ICN_"V"_CHECKSUM
+2 ; DGREQNAM (Required) - Requester name. Ex: "VistAData"
+3 ; Output: DGENSTAT (Pass by reference) - Contains the enrollment status. NULL = ICN is unknown to ES
+4 ; DGWSHTOE (Pass by reference) - Contains the "Do You Wish To Enroll?" value.
+5 ; DGCOMP (Pass by reference) - Contains the "COMPACT Act Eligible?" value.
+6 ; Return: DGRESP - the response in the format "N^Descriptive text".
+7 ; 1 - An enrollment status exists. Descriptive text=Enrollment Status
+8 ; 0 - No enrollment status exists OR Invalid ICN OR Network error.
+9 ;
+10 NEW DGEEOBJ,DGSUMMARY,DGSTCODE,DGRESP
+11 NEW $ETRAP,$ESTACK
+12 ; set error trap
+13 SET $ETRAP="DO ERR^DGREGEEWS"
+14 SET (DGENSTAT,DGWSHTOE,DGSTCODE,DGCOMP)=""
+15 SET DGRESP="0^Unknown error"
+16 DO GETSUMM(.DGSUMMARY)
+17 IF '$GET(DGSUMMARY)
QUIT DGRESP
+18 DO RESULTS(.DGSUMMARY)
+19 QUIT DGRESP
+20 ;
GETSUMM(DGSUMMARY) ; Set up web service object through HWSC.
+1 ; Output: DGSUMMARY object
+2 IF '$$FIND1^DIC(18.12,,"B","DG EE SUMMARY SERVER")!'$$FIND1^DIC(18.02,,"B","DG EE SUMMARY SERVICE")
SET DGRESP="0^Web services are not set up"
QUIT
+3 SET DGEEOBJ=$$GETPROXY^XOBWLIB("DG EE SUMMARY SERVICE","DG EE SUMMARY SERVER")
+4 ; set passwords to force creation of security headers
SET DGEEOBJ.Password=DGEEOBJ.HttpPassword
+5 SET DGEEOBJ.HttpPassword=""
+6 SET DGEEOBJ.Username=DGEEOBJ.HttpUsername
+7 SET DGEEOBJ.HttpUsername=""
+8 ; If ICN is valid a DGSUMMARY object will be returned
+9 ; If ICN is invalid a 500 error msg will be returned with a <ZSOAP> error & gracefully exit via ERR tag.
+10 ; get summary data
DO DGEEOBJ.getEESummary(DGKEY,"",DGREQNAM,"",.DGSUMMARY)
+11 QUIT
RESULTS(DGSUMMARY) ; get enrollment status and "do you wish to enroll value?"
+1 ; Input: DGSUMMARY object
+2 DO STATCODE
+3
*** ERROR ***
IF $ISO(DGSUMMARY.enrollmentDeterminationInfo)
Begin DoDot:1
+4 SET DGRESP="1^"_DGSTCODE_" Valid ICN and known to ES"
+5 SET DGENSTAT=DGSUMMARY.enrollmentDeterminationInfo.enrollmentStatus
+6 SET DGWSHTOE=DGSUMMARY.enrollmentDeterminationInfo.registrationInfo.doYouWishToEnroll
+7 SET DGCOMP=DGSUMMARY.enrollmentDeterminationInfo.compactActIndicator
End DoDot:1
QUIT
+8 IF '$TEST
Begin DoDot:1
+9 SET DGRESP="0^"_DGSTCODE_" Valid ICN but UNKNOWN to ES"
End DoDot:1
+10 QUIT
STATCODE ; http response status code
+1 SET DGSTCODE=DGEEOBJ.HttpResponse.StatusCode
+2 QUIT
ERR ; error trapping code
+1 NEW $ETRAP,$ESTACK,DGERR,DGTEXT
+2 ; if there's an error in the error handler just quit.
+3 SET $ETRAP="DO QUIT^DGREGEEWS"
+4 SET DGERR=$$EOFAC^XOBWLIB()
+5 DO STATCODE
+6 SET DGTEXT="Error has been logged in error log"
+7
*** ERROR ***
SET DGTEXT=$SELECT($ISO(DGEEOBJ.SoapFault):DGEEOBJ.SoapFault.faultstring,1:DGTEXT)
+8 SET DGRESP="0^"_DGSTCODE_" "_DGTEXT
+9 ; if code is not 6248 PERSON_NOT_FOUND it is some other error. Log it.
+10 IF DGERR.code'=6248
DO ZTER^XOBWLIB(DGERR)
+11 SET $ECODE=""
+12 DO UNWIND^%ZTER
+13 QUIT
QUIT ;
+1 DO ZTER^XOBWLIB(DGERR)
+2 QUIT