YTSAUDTC ;SLC/PIJ - Score AUDC ; 01/08/2016
;;5.01;MENTAL HEALTH;**123,141**;DEC 30,1994;Build 85
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
;
DATA1 ;
; get DFN and Sex of Patient
S DATA=$G(YSDATA(2))
S YSDFN=$P($G(DATA),U,2)
S YSSEX=$$GET1^DIQ(2,YSDFN_",",.02,"I")
S YSINSNAM=$P(DATA,U,3)
S YSGVN=$P(DATA,U,4)
S YSSRC=$S(+DATA:$P($G(^YTT(601.84,+DATA,0)),U,13),1:0)
S NODE=2 F S NODE=$O(YSDATA(NODE)) Q:NODE="" D
.S DATA=YSDATA(NODE)
.S YSQN=$P($G(DATA),U,1)
.S YSCDA=$P($G(DATA),U,3) ; Choice ID
.S LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
.S SCORE=SCORE+LEG
Q
;
SCORE ;
I '$D(^TMP($J,"YSCOR")) D QUIT
.S SC="| "_YSINSNAM_" score could not be determined. "
;
S SCORE=$P($G(^TMP($J,"YSCOR",2)),"=",2)
; cut-off after question 3 set up to vary based on sex
I 'YSGVN!YSSRC D QUIT ; 'YSGVN if no admin yet, YSSRC if MHA > 1.0.3.81
. S SC=" Score: "_SCORE_" points, which is a "_$S(SCORE>=5:"positive",1:"negative")_" result."
; otherwise, use original cut-off
I YSSEX="F" D QUIT
.S SC=" Score: "_SCORE_" points, which is a "_$S(SCORE>=3:"positive",1:"negative")_" result."
S SC=" Score: "_SCORE_" points, which is a "_$S(SCORE>=4:"positive",1:"negative")_" result."
Q
;
SCORESV ;
I $D(^TMP($J,"YSG",1)),^TMP($J,"YSG",1)="[ERROR]" D Q ;-->out
.K ^TMP($J,"YSCOR")
.S ^TMP($J,"YSCOR",1)="[ERROR]"
.S ^TMP($J,"YSCOR",2)="No Scale found for ADMIN"
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,276_",",3,"I")_"="_SCORE
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,LEG,NODE,SCORE,SC
N YSCDA,YSDFN,YSINSNAM,YSSEX,YSQN,YSGVN,YSSRC
;
S (SC,YSSEX)=""
S SCORE=0
D DATA1
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.D LDSCORES^YTSCORE(.YSDATA,.YS)
.D SCORE
.S YSDATA($O(YSDATA(""),-1)+1)=999999999999_U_U_SC
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSAUDTC 1944 printed Dec 13, 2024@02:19:12 Page 2
YTSAUDTC ;SLC/PIJ - Score AUDC ; 01/08/2016
+1 ;;5.01;MENTAL HEALTH;**123,141**;DEC 30,1994;Build 85
+2 ;
+3 ;Public, Supported ICRs
+4 ; #2056 - Fileman API - $$GET1^DIQ
+5 ;
+6 ;
DATA1 ;
+1 ; get DFN and Sex of Patient
+2 SET DATA=$GET(YSDATA(2))
+3 SET YSDFN=$PIECE($GET(DATA),U,2)
+4 SET YSSEX=$$GET1^DIQ(2,YSDFN_",",.02,"I")
+5 SET YSINSNAM=$PIECE(DATA,U,3)
+6 SET YSGVN=$PIECE(DATA,U,4)
+7 SET YSSRC=$SELECT(+DATA:$PIECE($GET(^YTT(601.84,+DATA,0)),U,13),1:0)
+8 SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+9 SET DATA=YSDATA(NODE)
+10 SET YSQN=$PIECE($GET(DATA),U,1)
+11 ; Choice ID
SET YSCDA=$PIECE($GET(DATA),U,3)
+12 SET LEG=$$GET1^DIQ(601.75,YSCDA_",",4,"I")
+13 SET SCORE=SCORE+LEG
End DoDot:1
+14 QUIT
+15 ;
SCORE ;
+1 IF '$DATA(^TMP($JOB,"YSCOR"))
Begin DoDot:1
+2 SET SC="| "_YSINSNAM_" score could not be determined. "
End DoDot:1
QUIT
+3 ;
+4 SET SCORE=$PIECE($GET(^TMP($JOB,"YSCOR",2)),"=",2)
+5 ; cut-off after question 3 set up to vary based on sex
+6 ; 'YSGVN if no admin yet, YSSRC if MHA > 1.0.3.81
IF 'YSGVN!YSSRC
Begin DoDot:1
+7 SET SC=" Score: "_SCORE_" points, which is a "_$SELECT(SCORE>=5:"positive",1:"negative")_" result."
End DoDot:1
QUIT
+8 ; otherwise, use original cut-off
+9 IF YSSEX="F"
Begin DoDot:1
+10 SET SC=" Score: "_SCORE_" points, which is a "_$SELECT(SCORE>=3:"positive",1:"negative")_" result."
End DoDot:1
QUIT
+11 SET SC=" Score: "_SCORE_" points, which is a "_$SELECT(SCORE>=4:"positive",1:"negative")_" result."
+12 QUIT
+13 ;
SCORESV ;
+1 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+2 KILL ^TMP($JOB,"YSCOR")
+3 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+4 SET ^TMP($JOB,"YSCOR",2)="No Scale found for ADMIN"
End DoDot:1
QUIT
+5 ;
+6 KILL ^TMP($JOB,"YSCOR")
+7 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+8 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,276_",",3,"I")_"="_SCORE
+9 QUIT
+10 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,LEG,NODE,SCORE,SC
+4 NEW YSCDA,YSDFN,YSINSNAM,YSSEX,YSQN,YSGVN,YSSRC
+5 ;
+6 SET (SC,YSSEX)=""
+7 SET SCORE=0
+8 DO DATA1
+9 IF YSTRNG=1
DO SCORESV
+10 IF YSTRNG=2
Begin DoDot:1
+11 DO LDSCORES^YTSCORE(.YSDATA,.YS)
+12 DO SCORE
+13 SET YSDATA($ORDER(YSDATA(""),-1)+1)=999999999999_U_U_SC
End DoDot:1
+14 QUIT