SDESSTOREPATIENT ;ALB/BLB - SDES STORE 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
;
STORE(JSON,DFN,USERID) ;
N ERRORS,RETURN
;
D VALIDATEDFN(.ERRORS,$G(DFN))
D VALIDATEUSERID(.ERRORS,$G(USERID))
I $D(ERRORS) M RETURN=ERRORS D BUILDJSON(.JSON,.RETURN) Q
;
D RECALL^DILFD(2,DFN_",",USERID)
S RETURN("PatientRecordCreated",1)=1
D BUILDJSON(.JSON,.RETURN) Q
Q
;
VALIDATEDFN(ERRORS,DFN) ;
I DFN="" D ERRLOG^SDESJSON(.ERRORS,1) Q 0
I DFN'="",'$D(^DPT(DFN,0)) D ERRLOG^SDESJSON(.ERRORS,2) Q
Q
;
VALIDATEUSERID(ERRORS,USERID) ;
I $G(USERID)="" D ERRLOG^SDESJSON(.ERRORS,441)
I $G(USERID)'="",'$D(^VA(200,$G(USERID),0)) D ERRLOG^SDESJSON(.ERRORS,442)
Q
;
BUILDJSON(JSONRETURN,RETURN) ;
N JSONERROR
D ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESSTOREPATIENT 909 printed Dec 13, 2024@02:57:48 Page 2
SDESSTOREPATIENT ;ALB/BLB - SDES STORE 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 ;
STORE(JSON,DFN,USERID) ;
+1 NEW ERRORS,RETURN
+2 ;
+3 DO VALIDATEDFN(.ERRORS,$GET(DFN))
+4 DO VALIDATEUSERID(.ERRORS,$GET(USERID))
+5 IF $DATA(ERRORS)
MERGE RETURN=ERRORS
DO BUILDJSON(.JSON,.RETURN)
QUIT
+6 ;
+7 DO RECALL^DILFD(2,DFN_",",USERID)
+8 SET RETURN("PatientRecordCreated",1)=1
+9 DO BUILDJSON(.JSON,.RETURN)
QUIT
+10 QUIT
+11 ;
VALIDATEDFN(ERRORS,DFN) ;
+1 IF DFN=""
DO ERRLOG^SDESJSON(.ERRORS,1)
QUIT 0
+2 IF DFN'=""
IF '$DATA(^DPT(DFN,0))
DO ERRLOG^SDESJSON(.ERRORS,2)
QUIT
+3 QUIT
+4 ;
VALIDATEUSERID(ERRORS,USERID) ;
+1 IF $GET(USERID)=""
DO ERRLOG^SDESJSON(.ERRORS,441)
+2 IF $GET(USERID)'=""
IF '$DATA(^VA(200,$GET(USERID),0))
DO ERRLOG^SDESJSON(.ERRORS,442)
+3 QUIT
+4 ;
BUILDJSON(JSONRETURN,RETURN) ;
+1 NEW JSONERROR
+2 DO ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
+3 QUIT
+4 ;