HMPORRPC ;ASMR/MBS -- Orders RPCs ;01/06/2015 16:42
;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2**;Dec 22, 2015;Build 28
;Per VA Directive 6402, this routine should not be modified.
; External References DBIA#
; ------------------- -----
; ^OR(100 5771
; DIQ 2056
Q
RELATED(RET,IEN) ;
N RESULT,I,HMPSIBS,HMPKIDS,PARENT
S RESULT=$NA(^TMP($J,"HMPORRPC")) K @RESULT
I '+$G(IEN) S @RESULT@("error")="No order selected" G JSONIFY
I '+$$GET1^DIQ(100,IEN_",",".01","I") S @RESULT@("error")="Nonexisting order" G JSONIFY
;See if we have a parent
S PARENT=$$GET1^DIQ(100,IEN_",",36,"I")
I +PARENT D
. S @RESULT@("parent")=PARENT
. ;Check for siblings
. D LIST^DIC(100.002,","_PARENT_",","@;.01","I",,,,,,,"HMPSIBS")
. F I=1:1:+$G(HMPSIBS("DILIST",0)) D
. . Q:$G(HMPSIBS("DILIST",2,I))=IEN
. . S @RESULT@("siblings",I)=$G(HMPSIBS("DILIST",2,I))
;Get children
D LIST^DIC(100.002,","_IEN_",","@;.01","I",,,,,,,"HMPKIDS")
F I=1:1:+$G(HMPKIDS("DILIST",0)) D
. S @RESULT@("children",I)=$G(HMPKIDS("DILIST",2,I))
;US11945 - If we're calling this from HMPDJ01, don't convert to JSON yet
I $G(HMPNOJS)=1 S RET=RESULT Q
JSONIFY ;
D ENCODE^HMPJSON(RESULT,"RET")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPORRPC 1273 printed Nov 22, 2024@17:04:35 Page 2
HMPORRPC ;ASMR/MBS -- Orders RPCs ;01/06/2015 16:42
+1 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2**;Dec 22, 2015;Build 28
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ; External References DBIA#
+4 ; ------------------- -----
+5 ; ^OR(100 5771
+6 ; DIQ 2056
+7 QUIT
RELATED(RET,IEN) ;
+1 NEW RESULT,I,HMPSIBS,HMPKIDS,PARENT
+2 SET RESULT=$NAME(^TMP($JOB,"HMPORRPC"))
KILL @RESULT
+3 IF '+$GET(IEN)
SET @RESULT@("error")="No order selected"
GOTO JSONIFY
+4 IF '+$$GET1^DIQ(100,IEN_",",".01","I")
SET @RESULT@("error")="Nonexisting order"
GOTO JSONIFY
+5 ;See if we have a parent
+6 SET PARENT=$$GET1^DIQ(100,IEN_",",36,"I")
+7 IF +PARENT
Begin DoDot:1
+8 SET @RESULT@("parent")=PARENT
+9 ;Check for siblings
+10 DO LIST^DIC(100.002,","_PARENT_",","@;.01","I",,,,,,,"HMPSIBS")
+11 FOR I=1:1:+$GET(HMPSIBS("DILIST",0))
Begin DoDot:2
+12 if $GET(HMPSIBS("DILIST",2,I))=IEN
QUIT
+13 SET @RESULT@("siblings",I)=$GET(HMPSIBS("DILIST",2,I))
End DoDot:2
End DoDot:1
+14 ;Get children
+15 DO LIST^DIC(100.002,","_IEN_",","@;.01","I",,,,,,,"HMPKIDS")
+16 FOR I=1:1:+$GET(HMPKIDS("DILIST",0))
Begin DoDot:1
+17 SET @RESULT@("children",I)=$GET(HMPKIDS("DILIST",2,I))
End DoDot:1
+18 ;US11945 - If we're calling this from HMPDJ01, don't convert to JSON yet
+19 IF $GET(HMPNOJS)=1
SET RET=RESULT
QUIT
JSONIFY ;
+1 DO ENCODE^HMPJSON(RESULT,"RET")
+2 QUIT