SDESGETSTOREDPAT ;ALB/BLB - SDES GET LAST SELECTED PAT; Apr 04, 2023@09:00
;;5.3;Scheduling;**846**;Aug 13, 1993;Build 12
;;Per VHA Directive 6402, this routine should not be modified
Q
;
GETSTOREDPATIENT(JSON,USERID) ;
N RETURN,DFN,ERRORS
;
I '$$VALIDATEUSERID(.ERRORS,$G(USERID)) M RETURN=ERRORS D BUILDJSON(.JSON,.RETURN) Q
;
S DFN=$G(^DISV($G(USERID),"^DPT("))
S RETURN("PatientIEN")=DFN
S RETURN("PatientName")=$$GET1^DIQ(2,DFN,.01,"E")
D BUILDJSON(.JSON,.RETURN) Q
Q
;
VALIDATEUSERID(ERRORS,USERID) ;
I $G(USERID)="" D ERRLOG^SDESJSON(.ERRORS,441) Q 0
I $G(USERID)'="",'$D(^VA(200,$G(USERID),0)) D ERRLOG^SDESJSON(.ERRORS,442) Q 0
Q 1
;
BUILDJSON(JSONRETURN,RETURN) ;
N JSONERROR
D ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETSTOREDPAT 789 printed Dec 13, 2024@02:57:10 Page 2
SDESGETSTOREDPAT ;ALB/BLB - SDES GET LAST SELECTED PAT; Apr 04, 2023@09:00
+1 ;;5.3;Scheduling;**846**;Aug 13, 1993;Build 12
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 QUIT
+4 ;
GETSTOREDPATIENT(JSON,USERID) ;
+1 NEW RETURN,DFN,ERRORS
+2 ;
+3 IF '$$VALIDATEUSERID(.ERRORS,$GET(USERID))
MERGE RETURN=ERRORS
DO BUILDJSON(.JSON,.RETURN)
QUIT
+4 ;
+5 SET DFN=$GET(^DISV($GET(USERID),"^DPT("))
+6 SET RETURN("PatientIEN")=DFN
+7 SET RETURN("PatientName")=$$GET1^DIQ(2,DFN,.01,"E")
+8 DO BUILDJSON(.JSON,.RETURN)
QUIT
+9 QUIT
+10 ;
VALIDATEUSERID(ERRORS,USERID) ;
+1 IF $GET(USERID)=""
DO ERRLOG^SDESJSON(.ERRORS,441)
QUIT 0
+2 IF $GET(USERID)'=""
IF '$DATA(^VA(200,$GET(USERID),0))
DO ERRLOG^SDESJSON(.ERRORS,442)
QUIT 0
+3 QUIT 1
+4 ;
BUILDJSON(JSONRETURN,RETURN) ;
+1 NEW JSONERROR
+2 DO ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
+3 QUIT
+4 ;