SDESGETCONDETAIL ;ALB/BLB - SDES GET CONSULT DETAILS ;Jan 17, 2023
;;5.3;Scheduling;**842**;Aug 13, 1993;Build 17
;;Per VHA Directive 6402, this routine should not be modified
Q
;
GETDETAILS(JSONRETURN,CONSULTIEN) ;
N ERRORS,RETURN,CONSULTDETAILS,TMPRETURN,DETAILS
I '$$VALIDATECONSULT(.ERRORS,$G(CONSULTIEN)) M RETURN=ERRORS D BUILDJSON(.JSONRETURN,.RETURN) Q
;
K ^TMP("GMRCR",$J,"DT")
D DETAIL^ORQQCN(.TMPRETURN,CONSULTIEN)
M DETAILS("ConsultDetails")=^TMP("GMRCR",$J)
;
D CLEANRETURN(.DETAILS,.CONSULTDETAILS)
;
I '$D(CONSULTDETAILS) S CONSULTDETAILS("ConsultDetails",1)=""
M RETURN=CONSULTDETAILS D BUILDJSON(.JSONRETURN,.RETURN)
Q
;
CLEANRETURN(DETAILS,CONSULTDETAILS) ;
N NUM
S NUM=0
F S NUM=$O(DETAILS("ConsultDetails","DT",NUM)) Q:'NUM D
.S CONSULTDETAILS("ConsultDetails","DT",NUM)=$G(DETAILS("ConsultDetails","DT",NUM,0))
Q
;
VALIDATECONSULT(ERRORS,CONSULTIEN) ;
I CONSULTIEN="" D ERRLOG^SDESJSON(.ERRORS,5) Q 0
I CONSULTIEN'="",'$D(^GMR(123,CONSULTIEN,0)) D ERRLOG^SDESJSON(.ERRORS,6) Q 0
Q 1
;
BUILDJSON(JSONRETURN,RETURN) ;
D ENCODE^XLFJSON("RETURN","JSONRETURN")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETCONDETAIL 1148 printed Nov 22, 2024@18:06:45 Page 2
SDESGETCONDETAIL ;ALB/BLB - SDES GET CONSULT DETAILS ;Jan 17, 2023
+1 ;;5.3;Scheduling;**842**;Aug 13, 1993;Build 17
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 QUIT
+4 ;
GETDETAILS(JSONRETURN,CONSULTIEN) ;
+1 NEW ERRORS,RETURN,CONSULTDETAILS,TMPRETURN,DETAILS
+2 IF '$$VALIDATECONSULT(.ERRORS,$GET(CONSULTIEN))
MERGE RETURN=ERRORS
DO BUILDJSON(.JSONRETURN,.RETURN)
QUIT
+3 ;
+4 KILL ^TMP("GMRCR",$JOB,"DT")
+5 DO DETAIL^ORQQCN(.TMPRETURN,CONSULTIEN)
+6 MERGE DETAILS("ConsultDetails")=^TMP("GMRCR",$JOB)
+7 ;
+8 DO CLEANRETURN(.DETAILS,.CONSULTDETAILS)
+9 ;
+10 IF '$DATA(CONSULTDETAILS)
SET CONSULTDETAILS("ConsultDetails",1)=""
+11 MERGE RETURN=CONSULTDETAILS
DO BUILDJSON(.JSONRETURN,.RETURN)
+12 QUIT
+13 ;
CLEANRETURN(DETAILS,CONSULTDETAILS) ;
+1 NEW NUM
+2 SET NUM=0
+3 FOR
SET NUM=$ORDER(DETAILS("ConsultDetails","DT",NUM))
if 'NUM
QUIT
Begin DoDot:1
+4 SET CONSULTDETAILS("ConsultDetails","DT",NUM)=$GET(DETAILS("ConsultDetails","DT",NUM,0))
End DoDot:1
+5 QUIT
+6 ;
VALIDATECONSULT(ERRORS,CONSULTIEN) ;
+1 IF CONSULTIEN=""
DO ERRLOG^SDESJSON(.ERRORS,5)
QUIT 0
+2 IF CONSULTIEN'=""
IF '$DATA(^GMR(123,CONSULTIEN,0))
DO ERRLOG^SDESJSON(.ERRORS,6)
QUIT 0
+3 QUIT 1
+4 ;
BUILDJSON(JSONRETURN,RETURN) ;
+1 DO ENCODE^XLFJSON("RETURN","JSONRETURN")
+2 QUIT
+3 ;