SDES2GETURGENCY ;ALB/BWF - SDES2 GET URGENCY LIST; MAR 11,2024
;;5.3;Scheduling;**875**;Aug 13, 1993;Build 25
;;Per VHA Directive 6402, this routine should not be modified
;
; Reference to PROTOCOL in ICR #7026
;
Q
; Input
; SDCONTEXT - SD CONTEXT ARRAY
; SDINPUT - blank placeholder parameter
;
GETURGENCY(RES,SDCONTEXT,SDINPUT) ; GET valid urgency protocol values that are used in the URGENCY field 5 of the REQUEST CONSULTAION file 123
N ERRORS,URGCOUNT,URGENCY,URGENCYIEN,SDNAME,URGENCYLIST,SYNIEN,SYNCOUNT,SYNNAME
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
I $D(ERRORS) S ERRORS("Urgency",1)="" D BUILDJSON^SDES2JSON(.RES,.ERRORS) Q
S URGCOUNT=0
S URGENCY="GMRCURGENCY" F S URGENCY=$O(^ORD(101,"B",URGENCY)) Q:$P(URGENCY," ",1)'="GMRCURGENCY" Q:URGENCY="" D
.S URGENCYIEN="" F S URGENCYIEN=$O(^ORD(101,"B",URGENCY,URGENCYIEN)) Q:URGENCYIEN="" D
..S SDNAME=$$GET1^DIQ(101,URGENCYIEN_",",.01)
..S URGCOUNT=URGCOUNT+1
..S URGENCYLIST("Urgency",URGCOUNT,"Name")=SDNAME
..S URGENCYLIST("Urgency",URGCOUNT,"Id")=URGENCYIEN
..S (SYNIEN,SYNCOUNT)=0
..F S SYNIEN=$O(^ORD(101,URGENCYIEN,2,SYNIEN)) Q:SYNIEN'>0 D
...S SYNNAME=$$GET1^DIQ(101.02,SYNIEN_","_URGENCYIEN_",",.01)
...S SYNCOUNT=SYNCOUNT+1
...S URGENCYLIST("Urgency",URGCOUNT,"Synonym",SYNCOUNT,"SynonymName")=SYNNAME
I '$D(URGENCYLIST) S URGENCYLIST("Urgency",1)=""
D BUILDJSON^SDES2JSON(.RES,.URGENCYLIST)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETURGENCY 1437 printed Dec 13, 2024@02:54:16 Page 2
SDES2GETURGENCY ;ALB/BWF - SDES2 GET URGENCY LIST; MAR 11,2024
+1 ;;5.3;Scheduling;**875**;Aug 13, 1993;Build 25
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ; Reference to PROTOCOL in ICR #7026
+5 ;
+6 QUIT
+7 ; Input
+8 ; SDCONTEXT - SD CONTEXT ARRAY
+9 ; SDINPUT - blank placeholder parameter
+10 ;
GETURGENCY(RES,SDCONTEXT,SDINPUT) ; GET valid urgency protocol values that are used in the URGENCY field 5 of the REQUEST CONSULTAION file 123
+1 NEW ERRORS,URGCOUNT,URGENCY,URGENCYIEN,SDNAME,URGENCYLIST,SYNIEN,SYNCOUNT,SYNNAME
+2 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+3 IF $DATA(ERRORS)
SET ERRORS("Urgency",1)=""
DO BUILDJSON^SDES2JSON(.RES,.ERRORS)
QUIT
+4 SET URGCOUNT=0
+5 SET URGENCY="GMRCURGENCY"
FOR
SET URGENCY=$ORDER(^ORD(101,"B",URGENCY))
if $PIECE(URGENCY," ",1)'="GMRCURGENCY"
QUIT
if URGENCY=""
QUIT
Begin DoDot:1
+6 SET URGENCYIEN=""
FOR
SET URGENCYIEN=$ORDER(^ORD(101,"B",URGENCY,URGENCYIEN))
if URGENCYIEN=""
QUIT
Begin DoDot:2
+7 SET SDNAME=$$GET1^DIQ(101,URGENCYIEN_",",.01)
+8 SET URGCOUNT=URGCOUNT+1
+9 SET URGENCYLIST("Urgency",URGCOUNT,"Name")=SDNAME
+10 SET URGENCYLIST("Urgency",URGCOUNT,"Id")=URGENCYIEN
+11 SET (SYNIEN,SYNCOUNT)=0
+12 FOR
SET SYNIEN=$ORDER(^ORD(101,URGENCYIEN,2,SYNIEN))
if SYNIEN'>0
QUIT
Begin DoDot:3
+13 SET SYNNAME=$$GET1^DIQ(101.02,SYNIEN_","_URGENCYIEN_",",.01)
+14 SET SYNCOUNT=SYNCOUNT+1
+15 SET URGENCYLIST("Urgency",URGCOUNT,"Synonym",SYNCOUNT,"SynonymName")=SYNNAME
End DoDot:3
End DoDot:2
End DoDot:1
+16 IF '$DATA(URGENCYLIST)
SET URGENCYLIST("Urgency",1)=""
+17 DO BUILDJSON^SDES2JSON(.RES,.URGENCYLIST)
+18 QUIT