SDES2GETVVCCODES ;ALB/JAS - SDES2 GET VVC STOP CODES ;NOV 15, 2023
;;5.3;Scheduling;**864**;Aug 13, 1993;Build 15
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
; RPC: SDES2 GET VVC STOP CODES
;
; SDCONTEXT("ACHERON AUDIT ID") = 36 character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
; SDCONTEXT("USER DUZ") = The DUZ of the user taking action on the calling application.
; SDCONTEXT("USER SECID") = The Security ID of the user taking action on the calling application.
; SDCONTEXT("PATIENT DFN") = The DFN of the Veteran/user taking action on the calling application.
; SDCONTEXT("PATIENT ICN") = The ICN of the Veteran/user taking action on the calling application.
;
; PARAMS("") = No input parameters for this RPC
;
GETVVCCODES(JSONRETURN,SDCONTEXT) ; Get VVC Stop Codes
;
N SDERRORS,SDRETURN,VALCHK
;
; Validate SDCONTEXT
;
S VALCHK=$$VALCONTXT(.SDCONTEXT,.SDERRORS)
I 'VALCHK M SDRETURN=SDERRORS S SDRETURN("VVCStopCode",1)="" D BUILDJSON^SDES2JSON(.JSONRETURN,.SDRETURN) Q
;
; Get National VVC Stop Codes entries from ^SDEC(409.98 - SDEC SETTINGS FILE
;
D GETDATA(.SDRETURN)
;
I '$D(SDRETURN) S SDRETURN("VVCStopCode",1)="" ;
;
; Build JSON return
;
D BUILDJSON^SDES2JSON(.JSONRETURN,.SDRETURN)
Q
;
VALCONTXT(SDCONTEXT,SDERRORS) ; Validate SDCONTEXT array
D VALCONTEXT^SDES2VALCONTEXT(.SDERRORS,.SDCONTEXT)
I $D(SDERRORS) Q 0
Q 1
;
GETDATA(SDRETURN) ; Get Stop Codes and format return
N AMISSTOPCD,CLINSTPNAME,CLINSTPIEN,SDCOUNT,SDSETIEN
S SDCOUNT=0
;
; Get National VVC Stop Codes entries from ^SDEC(409.98) - SDEC SETTINGS FILE
S SDSETIEN=$O(^SDEC(409.98,"B","VS GUI NATIONAL",0)) Q:'SDSETIEN
S AMISSTOPCD=0
F S AMISSTOPCD=$O(^SDEC(409.98,SDSETIEN,3,"B",AMISSTOPCD)) Q:'AMISSTOPCD D
. ;
. ; Get Clinic Stop data from ^DIC(40.7)
. S CLINSTPIEN=$$AMISTOSTOPCODE^SDES2UTIL(AMISSTOPCD) Q:'CLINSTPIEN
. S CLINSTPNAME=$$GET1^DIQ(40.7,CLINSTPIEN,.01,"I")
. S SDCOUNT=SDCOUNT+1
. ;
. ; Format Return
. S SDRETURN("VVCStopCode",SDCOUNT,"StopCodeIEN")=CLINSTPIEN
. S SDRETURN("VVCStopCode",SDCOUNT,"StopCodeName")=CLINSTPNAME
. S SDRETURN("VVCStopCode",SDCOUNT,"StopCodeNumber")=AMISSTOPCD
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETVVCCODES 2271 printed Dec 13, 2024@02:54:19 Page 2
SDES2GETVVCCODES ;ALB/JAS - SDES2 GET VVC STOP CODES ;NOV 15, 2023
+1 ;;5.3;Scheduling;**864**;Aug 13, 1993;Build 15
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
+6 ; RPC: SDES2 GET VVC STOP CODES
+7 ;
+8 ; SDCONTEXT("ACHERON AUDIT ID") = 36 character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
+9 ; SDCONTEXT("USER DUZ") = The DUZ of the user taking action on the calling application.
+10 ; SDCONTEXT("USER SECID") = The Security ID of the user taking action on the calling application.
+11 ; SDCONTEXT("PATIENT DFN") = The DFN of the Veteran/user taking action on the calling application.
+12 ; SDCONTEXT("PATIENT ICN") = The ICN of the Veteran/user taking action on the calling application.
+13 ;
+14 ; PARAMS("") = No input parameters for this RPC
+15 ;
GETVVCCODES(JSONRETURN,SDCONTEXT) ; Get VVC Stop Codes
+1 ;
+2 NEW SDERRORS,SDRETURN,VALCHK
+3 ;
+4 ; Validate SDCONTEXT
+5 ;
+6 SET VALCHK=$$VALCONTXT(.SDCONTEXT,.SDERRORS)
+7 IF 'VALCHK
MERGE SDRETURN=SDERRORS
SET SDRETURN("VVCStopCode",1)=""
DO BUILDJSON^SDES2JSON(.JSONRETURN,.SDRETURN)
QUIT
+8 ;
+9 ; Get National VVC Stop Codes entries from ^SDEC(409.98 - SDEC SETTINGS FILE
+10 ;
+11 DO GETDATA(.SDRETURN)
+12 ;
+13 ;
IF '$DATA(SDRETURN)
SET SDRETURN("VVCStopCode",1)=""
+14 ;
+15 ; Build JSON return
+16 ;
+17 DO BUILDJSON^SDES2JSON(.JSONRETURN,.SDRETURN)
+18 QUIT
+19 ;
VALCONTXT(SDCONTEXT,SDERRORS) ; Validate SDCONTEXT array
+1 DO VALCONTEXT^SDES2VALCONTEXT(.SDERRORS,.SDCONTEXT)
+2 IF $DATA(SDERRORS)
QUIT 0
+3 QUIT 1
+4 ;
GETDATA(SDRETURN) ; Get Stop Codes and format return
+1 NEW AMISSTOPCD,CLINSTPNAME,CLINSTPIEN,SDCOUNT,SDSETIEN
+2 SET SDCOUNT=0
+3 ;
+4 ; Get National VVC Stop Codes entries from ^SDEC(409.98) - SDEC SETTINGS FILE
+5 SET SDSETIEN=$ORDER(^SDEC(409.98,"B","VS GUI NATIONAL",0))
if 'SDSETIEN
QUIT
+6 SET AMISSTOPCD=0
+7 FOR
SET AMISSTOPCD=$ORDER(^SDEC(409.98,SDSETIEN,3,"B",AMISSTOPCD))
if 'AMISSTOPCD
QUIT
Begin DoDot:1
+8 ;
+9 ; Get Clinic Stop data from ^DIC(40.7)
+10 SET CLINSTPIEN=$$AMISTOSTOPCODE^SDES2UTIL(AMISSTOPCD)
if 'CLINSTPIEN
QUIT
+11 SET CLINSTPNAME=$$GET1^DIQ(40.7,CLINSTPIEN,.01,"I")
+12 SET SDCOUNT=SDCOUNT+1
+13 ;
+14 ; Format Return
+15 SET SDRETURN("VVCStopCode",SDCOUNT,"StopCodeIEN")=CLINSTPIEN
+16 SET SDRETURN("VVCStopCode",SDCOUNT,"StopCodeName")=CLINSTPNAME
+17 SET SDRETURN("VVCStopCode",SDCOUNT,"StopCodeNumber")=AMISSTOPCD
End DoDot:1
+18 QUIT