YTSBAMI ;SLC/KCM - Verify for BAM-IOP ; 01/08/2016
;;5.01;MENTAL HEALTH;**130**;DEC 30,1994;Build 62
;
Q
;
VERIFY(ARGS,RESULTS) ; Add inconsistency messages based on set of answers in ARGS
N MSGCNT S MSGCNT=0
I $$LT("q6444","q6445") D MSG("more","4","5")
I $$LT("q6446","q6447") D MSG("less","7A","6")
I $$LT("q6446","q6448") D MSG("less","7B","6")
I $$LT("q6446","q6449") D MSG("less","7C","6")
I $$LT("q6446","q6450") D MSG("less","7D","6")
I $$LT("q6446","q6451") D MSG("less","7E","6")
I $$LT("q6446","q6452") D MSG("less","7F","6")
I $$LT("q6446","q6453") D MSG("less","7G","6")
S RESULTS("count")=MSGCNT
Q
LT(ID1,ID2) ; returns 1 if ID1 is less than ID2
; expects ARGS from VERIFY
N VAL1,VAL2
S VAL1=$E($G(ARGS(ID1)),2,9) S:VAL1=1156 VAL1=0 ; 1156 = skipped by rule
I VAL1 S VAL1=+$P($G(^YTT(601.75,VAL1,0)),U,2) ; legacy value for compare
S VAL2=$E($G(ARGS(ID2)),2,9) S:VAL2=1156 VAL2=0
I VAL2 S VAL2=+$P($G(^YTT(601.75,VAL2,0)),U,2)
I +VAL1<+VAL2 Q 1
Q 0
;
MSG(REL,Q1,Q2) ; Add text of message to RESULTS
; expects MSGCNT, RESULTS from VERIFY
N X
S X="There is an inconsistency: The number of days entered in Question "_Q1
S X=X_" should be equal to, or "_REL_" than,"
S X=X_" the number of days in Question "_Q2_"."
S MSGCNT=MSGCNT+1,RESULTS("messages",MSGCNT)=X
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSBAMI 1344 printed Dec 13, 2024@02:19:15 Page 2
YTSBAMI ;SLC/KCM - Verify for BAM-IOP ; 01/08/2016
+1 ;;5.01;MENTAL HEALTH;**130**;DEC 30,1994;Build 62
+2 ;
+3 QUIT
+4 ;
VERIFY(ARGS,RESULTS) ; Add inconsistency messages based on set of answers in ARGS
+1 NEW MSGCNT
SET MSGCNT=0
+2 IF $$LT("q6444","q6445")
DO MSG("more","4","5")
+3 IF $$LT("q6446","q6447")
DO MSG("less","7A","6")
+4 IF $$LT("q6446","q6448")
DO MSG("less","7B","6")
+5 IF $$LT("q6446","q6449")
DO MSG("less","7C","6")
+6 IF $$LT("q6446","q6450")
DO MSG("less","7D","6")
+7 IF $$LT("q6446","q6451")
DO MSG("less","7E","6")
+8 IF $$LT("q6446","q6452")
DO MSG("less","7F","6")
+9 IF $$LT("q6446","q6453")
DO MSG("less","7G","6")
+10 SET RESULTS("count")=MSGCNT
+11 QUIT
LT(ID1,ID2) ; returns 1 if ID1 is less than ID2
+1 ; expects ARGS from VERIFY
+2 NEW VAL1,VAL2
+3 ; 1156 = skipped by rule
SET VAL1=$EXTRACT($GET(ARGS(ID1)),2,9)
if VAL1=1156
SET VAL1=0
+4 ; legacy value for compare
IF VAL1
SET VAL1=+$PIECE($GET(^YTT(601.75,VAL1,0)),U,2)
+5 SET VAL2=$EXTRACT($GET(ARGS(ID2)),2,9)
if VAL2=1156
SET VAL2=0
+6 IF VAL2
SET VAL2=+$PIECE($GET(^YTT(601.75,VAL2,0)),U,2)
+7 IF +VAL1<+VAL2
QUIT 1
+8 QUIT 0
+9 ;
MSG(REL,Q1,Q2) ; Add text of message to RESULTS
+1 ; expects MSGCNT, RESULTS from VERIFY
+2 NEW X
+3 SET X="There is an inconsistency: The number of days entered in Question "_Q1
+4 SET X=X_" should be equal to, or "_REL_" than,"
+5 SET X=X_" the number of days in Question "_Q2_"."
+6 SET MSGCNT=MSGCNT+1
SET RESULTS("messages",MSGCNT)=X
+7 QUIT