YTQAPI2B ;SLC/BLD - MHAX ANSWERS SPECIAL HANDLING #2 ; 2/7/18 17:35
;;5.01;MENTAL HEALTH;**134,136,139,142**;Dec 30, 1994;Build 14
;
; This routine was split from YTQAPI2A.
; This routine handles limited complex reporting requirements without
; modifying YS_AUX.DLL by adding free text "answers" that can be used by
; a report.
;,
; Assumptions: EDIT incomplete instrument should ignore the extra answers
; since there are no associated questions. GRAPHING should ignore the
; answers since they not numeric.
;
SPECIAL(TSTNM,YSDATA,N,YSAD,YSTSTN) ; 1 add "hidden" computed question text
N ANSWER,DEPSCORE,IEN,KEY,LP,PCT,PTSD,SATTSCORE,SCORES,SCRE,SUCSCORE,SUISCORE,SWHENSCORES,TEXT,TEXT1,TEXT2
N TEXT2A,TEXT2B,TOT,YSCORE,YSCREC,SUISCRN,ALLQUES,POSTXT1,POSTXT2,QUE1621,QUE67,QUE915
;
I TSTNM="PC-PTSD-5+I9" D Q
.N I,YSCORE,PTSD,SCORES,SUISCRN,SWHENSCORE,TEXT
.S (ANSWER,SCORES)=0
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.S SCORES=$P(^TMP($J,"YSCOR",2),"=",2)
.I SCORES=0 D
..S YSDATA(N)="7776^9999;1^"_SCORES,N=N+1
..S YSDATA(N)="7771^9999;1^The score for this administration indicates a NEGATIVE screen for PTSD." S N=N+1
.S SUISCORE=$P(^TMP($J,"YSCOR",3),"=",2)
.I $G(SCORES)<4,$G(SCORES)>0 D
..S YSDATA(N)="7776^9999;1^"_SCORES,N=N+1
..S YSDATA(N)="7771^9999;1^The score for this administration is "_SCORES_", which indicates ",N=N+1
..S YSDATA(N)="7772^9999;1^ a NEGATIVE screen for PTSD in the past month." S N=N+1
.I $G(SCORES)>3 D
..S YSDATA(N)="7776^9999;1^"_SCORES,N=N+1
..S YSDATA(N)="7771^9999;1^The score for this administration is "_SCORES_", which indicates ",N=N+1
..S YSDATA(N)="7772^9999;1^ a POSITIVE screen for PTSD in the past month. Further assessment is recommended.",N=N+1
.;
.I $G(SUISCORE)=0 D
..S YSDATA(N)="7777^9999;1^"_SUISCORE,N=N+1
..S YSDATA(N)="7773^9999;1^The score on this administration is 0, which indicates a NEGATIVE ",N=N+1
..S YSDATA(N)="7774^9999;1^ screen for Risk of Suicide over the last 2 weeks."
.S SUISCRN=$P(^TMP($J,"YSCOR",3),"=",2)
.I SUISCRN>0 D
..S YSDATA(N)="7777^9999;1^"_SUISCORE,N=N+1
..I SUISCRN=1 S TEXT="SEVERAL DAYS"
..I SUISCRN=2 S TEXT="MORE THAN HALF THE DAYS"
..I SUISCRN=3 S TEXT="NEARLY EVERY DAY"
..S YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCRN_", which revealed suicidal ideation "_TEXT,N=N+1
..S YSDATA(N)="7774^9999;1^ over the last 2 weeks, which indicates a POSITIVE screen for Risk of Suicide.",N=N+1
.Q
;
;bld 3/1/2018 Complex Reporting for PC-PTSD-5
I TSTNM="PC-PTSD-5" D Q
.N I,YSCORE,PTSD,SCORES,TEXT
.S SCORES=0
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.S SCORES=$P(^TMP($J,"YSCOR",2),"=",2)
.I $G(SCORES)'>3 D
..S YSDATA(N)="7771^9999;1^ The score on this administration is "_SCORES_", which indicates a NEGATIVE screen for ",N=N+1
..S YSDATA(N)="7772^9999;1^ PTSD in the past month.",N=N+1
.I $G(SCORES)>3 D
..S YSDATA(N)="7771^9999;1^ The score on this administration is "_SCORES_", which indicates a POSITIVE screen for ",N=N+1
..S YSDATA(N)="7772^9999;1^ PTSD in the past month. Further assessment is recommended."
;
;bld 3/1/2018 Complex Reporting for PHQ-2+I9
I TSTNM="PHQ-2+I9" D Q
.N I,DEPSCORE,SUCSCORE,YSCORE,TEXT
.S N=N+1
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.S DEPSCORE=^TMP($J,"YSCOR",2)
.S DEPSCORE=$P(DEPSCORE,"=",2)
.S SUISCORE=^TMP($J,"YSCOR",3)
.S SUISCORE=$P(SUISCORE,"=",2)
.I DEPSCORE'>2 D
..S YSDATA(N)="7771^9999;1^The score on this administration is "_$G(DEPSCORE)_", which indicates a NEGATIVE screen ",N=N+1
..S YSDATA(N)="7772^9999;1^ on the Depression Scale over the past 2 weeks.",N=N+1
.I DEPSCORE>2 D
..S YSDATA(N)="7771^9999;1^The score on this administration is "_$G(DEPSCORE)_", which indicates a POSITIVE screen ",N=N+1
..S YSDATA(N)="7772^9999;1^ on the Depression Scale over the past 2 weeks.",N=N+1
.I SUISCORE=0 D
..S YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCORE_", which indicates a NEGATIVE screen ",N=N+1
..S YSDATA(N)="7774^9999;1^ for Risk of Suicide over the past 2 weeks.",N=N+1
.I SUISCORE>0 D
..I SUISCORE=1 S TEXT="SEVERAL DAYS"
..I SUISCORE=2 S TEXT="MORE THAN HALF THE DAYS"
..I SUISCORE=3 S TEXT="NEARLY EVERY DAY"
..S YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCORE_", which revealed suicidal ideation "_TEXT,N=N+1
..S YSDATA(N)="7774^9999;1^ over the past 2 weeks, which indicates a POSITIVE screen for Risk of Suicide.",N=N+1
.Q
;
;bld/dsb 3/1/2018 Complex Reporting for C-SSRS
I TSTNM="C-SSRS" D Q
.N I,YSCORE,YSCREC,PTSD,SCORES,SCRE,QUESNBR,TEXT,TEXT3,TEXT3A,TEXT3B,TEXT4,TEXT5,TEXT8,TEXT8A,TEXT8B,ADDTEXT,STRNG
.S SCORES=""
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.I ^TMP($J,"YSCOR",1)'="[DATA]" Q
.S LP=1
.S ADDTEXT="This indicates a clear need |for further assessment and clinical management."
.;
.S TEXT3=" This administration indicates presence of SUICIDAL IDEATION "
.S TEXT3A="WITH AT LEAST |SOME INTENT TO DIE in the past month. " ;q4=yes, q5=no
.; patch 142
.S TEXT3B="WITH |CONSIDERATION OF METHOD in the past month. "
.;
.S TEXT8=" ||This administration indicates presence of RECENT SUICIDAL BEHAVIOR. The |presence of ANY suicidal "
.S TEXT8A="behavior (suicide attempt, interrupted attempt, |aborted attempt and preparatory behavior) "
.S TEXT8B="in the past 3 months indicates |clear need for further assessment and clinical management."
.F S LP=$O(^TMP($J,"YSCOR",LP)) Q:'LP D
..; Yes=1, No=2 and Skipped=0
..S SCRE=$P(^TMP($J,"YSCOR",LP),"=",2)
..S SCORES=SCORES_SCRE
.; get Suicidal Ideation in last month - question 1 and 2
.D
..I $E(SCORES,2)=1 S YSDATA(N)="7771^9999;1^Yes - Suicidal thoughts" S N=N+1 Q
..I ($E(SCORES,1)=1)&($E(SCORES,2)=2) S YSDATA(N)="7771^9999;1^Yes - Wish to die" S N=N+1 Q
..I ($E(SCORES,1)=2)&($E(SCORES,2)=2) S YSDATA(N)="7771^9999;1^None endorsed" S N=N+1 Q
. ;
. ; get Method/plan/Intent in last month - question 3,4,5 and 6
. S IEN=N
. D I '$D(YSDATA(IEN)) D CSSRS(SCORES)
..I ($E(SCORES,5)=1)&($E(SCORES,6)=1) S YSDATA(N)="7772^9999;1^Method with specific plan and intent" S N=N+1 Q
..I ($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent" S N=N+1 Q
..I ($E(SCORES,3)=1)&($E(SCORES,4)=1)&($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent" S N=N+1 Q
..I ($E(SCORES,3)=1)&($E(SCORES,4)=1)&($E(SCORES,5)=2) S YSDATA(N)="7772^9999;1^Method with at least some intent and no specific plan" S N=N+1 Q
..I ($E(SCORES,3)=1)&($E(SCORES,4)=2)&($E(SCORES,5)=2) S YSDATA(N)="7772^9999;1^Method but with no specific plan or intent" S N=N+1 Q
..I ($E(SCORES,3)=2)&($E(SCORES,4)=2)&($E(SCORES,5)=2) S YSDATA(N)="7772^9999;1^No method, no specific plan, and no intent" S N=N+1 Q
..I ($E(SCORES,3)=2)&($E(SCORES,4)=2)&($E(SCORES,5)=1) S YSDATA(N)="7772^9999;1^Method with specific plan and no intent" S N=N+1 Q
..I ($E(SCORES,3)=2)&($E(SCORES,4)=1)&($E(SCORES,5)=1)&($E(SCORES,6)=1) S YSDATA(N)="7772^9999;1^Method with specific plan and some intent" S N=N+1 Q
..I ($E(SCORES,3)=2)&($E(SCORES,4)=1)&($E(SCORES,5)=2) S YSDATA(N)="7772^9999;1^Method with at least some intent and no specific plan" S N=N+1 Q
..I ($E(SCORES,3)=0)&($E(SCORES,4)=0)&($E(SCORES,5)=0) S YSDATA(N)="7772^9999;1^No method, no specific plan, and no intent" S N=N+1 Q
.;
.; get Sucidal Behavior based on question 7 and 8
.D
..I ($E(SCORES,8)=1) S YSDATA(N)="7773^9999;1^Recent Suicidal Behavior (<3 months)" S N=N+1 Q
..I ($E(SCORES,7)=1)&($E(SCORES,8)=2) S YSDATA(N)="7773^9999;1^Past Suicidal Behavior (>3 Months)" S N=N+1 Q
..I ($E(SCORES,7)=2) S YSDATA(N)="7773^9999;1^No Past Suicidal Behavior Reported" S N=N+1 Q
.;
.;Key Indicators, in Question 7774
.S STRNG=""
.I ($E(SCORES,3)=1)!($E(SCORES,4)=1)!($E(SCORES,5)=1) D
..S STRNG=TEXT3
..I ($E(SCORES,4)=1)!($E(SCORES,5)=1) S STRNG=STRNG_TEXT3A
..I ($E(SCORES,3)=1)&($E(SCORES,4)=2)&($E(SCORES,5)=2) S STRNG=STRNG_TEXT3B
..S STRNG=STRNG_ADDTEXT
.I ($E(SCORES,8)=1) D
..S STRNG=STRNG_TEXT8_TEXT8A_TEXT8B
.I $L(STRNG) S YSDATA(N)="7774^9999;1^"_STRNG
.Q
;
;dsb/BLD 3/1/2018 Complex Reporting for PSS-3
I TSTNM="PSS-3" D Q
.N I,YSCORE,PTSD,SCORES,DEPSCORE,SUISCORE,SATTSCORE,SWHENSCORES,SWHENSCORE,YSPSS3
.S SCORES=0
.S N=N+1
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.D PSS3(.YSPSS3)
.I ^TMP($J,"YSCOR",1)'="[DATA]" Q
.S DEPSCORE=$P(^TMP($J,"YSCOR",2),"=",2)
.S SUISCORE=$P(^TMP($J,"YSCOR",3),"=",2)
.S SATTSCORE=YSPSS3(7791)
.I DEPSCORE=0 S YSDATA(N)="7771^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Depressed Mood"
.I DEPSCORE=1 S YSDATA(N)="7771^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Depressed Mood"
.S N=N+1
.I SUISCORE=0 S YSDATA(N)="7772^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Active Suicidal Ideation"
.I SUISCORE=1 S YSDATA(N)="7772^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Active Suicidal Ideation"
.S N=N+1
.I SATTSCORE=0 S YSDATA(N+1)="7773^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Recent Suicide Attempt"
.I $G(SATTSCORE) D
..S SWHENSCORE=YSPSS3(7792)
..S N=N+1
..I SWHENSCORE>3 S YSDATA(N)="7773^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Recent Suicide Attempt"
..I SWHENSCORE<4 S YSDATA(N)="7773^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Recent Suicide Attempt"
.Q
;
;bld/dsb 3/1/2018 Complex Reporting for WHODAS2.0-12
I TSTNM="WHODAS2.0-12" D Q
.N I,PCT,LP,TOT,YSCORE
.S (PCT,TOT)=0
.D GETSCORE^YTQAPI8(.YSCORE,.YS)
.I ^TMP($J,"YSCOR",1)'="[DATA]" Q
.S LP=1
.F S LP=$O(^TMP($J,"YSCOR",LP)) Q:'LP D
..S TOT=TOT+$P(^TMP($J,"YSCOR",LP),"=",2)
.S YSDATA(N)="7771^9999;1^"_TOT
.Q
;
I $L($T(SPECIAL^YTQAPI2C)) D SPECIAL^YTQAPI2C(TSTNM,.YSDATA,N,.YSAD,.YSTSTN) Q
Q
;
CSSRS(SCORES) ;logic for method/plan/intent section of CSSRS report
;
I ($E(SCORES,5)=1)&($E(SCORES,6)=1) S YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent" S N=N+1 Q
I ($E(SCORES,5)=1)&($E(SCORES,6)=2) S YSDATA(N)="7772^9999;1^Method with specific plan and no intent" S N=N+1 Q
;
PSS3(YSPSS3) ;
N YSQN,YSAI,YSAN,YSANS
F YSQN=7791,7792 D
.S YSAI=$O(^YTT(601.85,"AC",YSAD,YSQN,0))
.Q:YSAI'>0
.Q:'$D(^YTT(601.85,YSAI,0)) ;ASF 11/15/07
.S YSAN=""
.I $P(^YTT(601.85,YSAI,0),U,4)?1N.N S YSAN=$P(^YTT(601.85,YSAI,0),U,4),YSAN=$G(^YTT(601.75,YSAN,1)),YSPSS3(YSQN)=YSAN
;
I YSPSS3(7791)="Yes" S YSPSS3(7791)=1
E S YSPSS3(7791)=0
S YSANS=YSPSS3(7792)
I YSANS["Within the past 24 hours (including today)" S YSPSS3(7792)=1 Q
I YSANS["Within the last month (but not today)" S YSPSS3(7792)=2 Q
I YSANS["Between 1 and 6 months ago" S YSPSS3(7792)=3 Q
I YSANS["More than 6 months ago" S YSPSS3(7792)=4 Q
E S YSPSS3(7792)=5
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTQAPI2B 11135 printed Oct 16, 2024@18:18:58 Page 2
YTQAPI2B ;SLC/BLD - MHAX ANSWERS SPECIAL HANDLING #2 ; 2/7/18 17:35
+1 ;;5.01;MENTAL HEALTH;**134,136,139,142**;Dec 30, 1994;Build 14
+2 ;
+3 ; This routine was split from YTQAPI2A.
+4 ; This routine handles limited complex reporting requirements without
+5 ; modifying YS_AUX.DLL by adding free text "answers" that can be used by
+6 ; a report.
+7 ;,
+8 ; Assumptions: EDIT incomplete instrument should ignore the extra answers
+9 ; since there are no associated questions. GRAPHING should ignore the
+10 ; answers since they not numeric.
+11 ;
SPECIAL(TSTNM,YSDATA,N,YSAD,YSTSTN) ; 1 add "hidden" computed question text
+1 NEW ANSWER,DEPSCORE,IEN,KEY,LP,PCT,PTSD,SATTSCORE,SCORES,SCRE,SUCSCORE,SUISCORE,SWHENSCORES,TEXT,TEXT1,TEXT2
+2 NEW TEXT2A,TEXT2B,TOT,YSCORE,YSCREC,SUISCRN,ALLQUES,POSTXT1,POSTXT2,QUE1621,QUE67,QUE915
+3 ;
+4 IF TSTNM="PC-PTSD-5+I9"
Begin DoDot:1
+5 NEW I,YSCORE,PTSD,SCORES,SUISCRN,SWHENSCORE,TEXT
+6 SET (ANSWER,SCORES)=0
+7 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+8 SET SCORES=$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+9 IF SCORES=0
Begin DoDot:2
+10 SET YSDATA(N)="7776^9999;1^"_SCORES
SET N=N+1
+11 SET YSDATA(N)="7771^9999;1^The score for this administration indicates a NEGATIVE screen for PTSD."
SET N=N+1
End DoDot:2
+12 SET SUISCORE=$PIECE(^TMP($JOB,"YSCOR",3),"=",2)
+13 IF $GET(SCORES)<4
IF $GET(SCORES)>0
Begin DoDot:2
+14 SET YSDATA(N)="7776^9999;1^"_SCORES
SET N=N+1
+15 SET YSDATA(N)="7771^9999;1^The score for this administration is "_SCORES_", which indicates "
SET N=N+1
+16 SET YSDATA(N)="7772^9999;1^ a NEGATIVE screen for PTSD in the past month."
SET N=N+1
End DoDot:2
+17 IF $GET(SCORES)>3
Begin DoDot:2
+18 SET YSDATA(N)="7776^9999;1^"_SCORES
SET N=N+1
+19 SET YSDATA(N)="7771^9999;1^The score for this administration is "_SCORES_", which indicates "
SET N=N+1
+20 SET YSDATA(N)="7772^9999;1^ a POSITIVE screen for PTSD in the past month. Further assessment is recommended."
SET N=N+1
End DoDot:2
+21 ;
+22 IF $GET(SUISCORE)=0
Begin DoDot:2
+23 SET YSDATA(N)="7777^9999;1^"_SUISCORE
SET N=N+1
+24 SET YSDATA(N)="7773^9999;1^The score on this administration is 0, which indicates a NEGATIVE "
SET N=N+1
+25 SET YSDATA(N)="7774^9999;1^ screen for Risk of Suicide over the last 2 weeks."
End DoDot:2
+26 SET SUISCRN=$PIECE(^TMP($JOB,"YSCOR",3),"=",2)
+27 IF SUISCRN>0
Begin DoDot:2
+28 SET YSDATA(N)="7777^9999;1^"_SUISCORE
SET N=N+1
+29 IF SUISCRN=1
SET TEXT="SEVERAL DAYS"
+30 IF SUISCRN=2
SET TEXT="MORE THAN HALF THE DAYS"
+31 IF SUISCRN=3
SET TEXT="NEARLY EVERY DAY"
+32 SET YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCRN_", which revealed suicidal ideation "_TEXT
SET N=N+1
+33 SET YSDATA(N)="7774^9999;1^ over the last 2 weeks, which indicates a POSITIVE screen for Risk of Suicide."
SET N=N+1
End DoDot:2
+34 QUIT
End DoDot:1
QUIT
+35 ;
+36 ;bld 3/1/2018 Complex Reporting for PC-PTSD-5
+37 IF TSTNM="PC-PTSD-5"
Begin DoDot:1
+38 NEW I,YSCORE,PTSD,SCORES,TEXT
+39 SET SCORES=0
+40 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+41 SET SCORES=$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+42 IF $GET(SCORES)'>3
Begin DoDot:2
+43 SET YSDATA(N)="7771^9999;1^ The score on this administration is "_SCORES_", which indicates a NEGATIVE screen for "
SET N=N+1
+44 SET YSDATA(N)="7772^9999;1^ PTSD in the past month."
SET N=N+1
End DoDot:2
+45 IF $GET(SCORES)>3
Begin DoDot:2
+46 SET YSDATA(N)="7771^9999;1^ The score on this administration is "_SCORES_", which indicates a POSITIVE screen for "
SET N=N+1
+47 SET YSDATA(N)="7772^9999;1^ PTSD in the past month. Further assessment is recommended."
End DoDot:2
End DoDot:1
QUIT
+48 ;
+49 ;bld 3/1/2018 Complex Reporting for PHQ-2+I9
+50 IF TSTNM="PHQ-2+I9"
Begin DoDot:1
+51 NEW I,DEPSCORE,SUCSCORE,YSCORE,TEXT
+52 SET N=N+1
+53 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+54 SET DEPSCORE=^TMP($JOB,"YSCOR",2)
+55 SET DEPSCORE=$PIECE(DEPSCORE,"=",2)
+56 SET SUISCORE=^TMP($JOB,"YSCOR",3)
+57 SET SUISCORE=$PIECE(SUISCORE,"=",2)
+58 IF DEPSCORE'>2
Begin DoDot:2
+59 SET YSDATA(N)="7771^9999;1^The score on this administration is "_$GET(DEPSCORE)_", which indicates a NEGATIVE screen "
SET N=N+1
+60 SET YSDATA(N)="7772^9999;1^ on the Depression Scale over the past 2 weeks."
SET N=N+1
End DoDot:2
+61 IF DEPSCORE>2
Begin DoDot:2
+62 SET YSDATA(N)="7771^9999;1^The score on this administration is "_$GET(DEPSCORE)_", which indicates a POSITIVE screen "
SET N=N+1
+63 SET YSDATA(N)="7772^9999;1^ on the Depression Scale over the past 2 weeks."
SET N=N+1
End DoDot:2
+64 IF SUISCORE=0
Begin DoDot:2
+65 SET YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCORE_", which indicates a NEGATIVE screen "
SET N=N+1
+66 SET YSDATA(N)="7774^9999;1^ for Risk of Suicide over the past 2 weeks."
SET N=N+1
End DoDot:2
+67 IF SUISCORE>0
Begin DoDot:2
+68 IF SUISCORE=1
SET TEXT="SEVERAL DAYS"
+69 IF SUISCORE=2
SET TEXT="MORE THAN HALF THE DAYS"
+70 IF SUISCORE=3
SET TEXT="NEARLY EVERY DAY"
+71 SET YSDATA(N)="7773^9999;1^The score on this administration is "_SUISCORE_", which revealed suicidal ideation "_TEXT
SET N=N+1
+72 SET YSDATA(N)="7774^9999;1^ over the past 2 weeks, which indicates a POSITIVE screen for Risk of Suicide."
SET N=N+1
End DoDot:2
+73 QUIT
End DoDot:1
QUIT
+74 ;
+75 ;bld/dsb 3/1/2018 Complex Reporting for C-SSRS
+76 IF TSTNM="C-SSRS"
Begin DoDot:1
+77 NEW I,YSCORE,YSCREC,PTSD,SCORES,SCRE,QUESNBR,TEXT,TEXT3,TEXT3A,TEXT3B,TEXT4,TEXT5,TEXT8,TEXT8A,TEXT8B,ADDTEXT,STRNG
+78 SET SCORES=""
+79 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+80 IF ^TMP($JOB,"YSCOR",1)'="[DATA]"
QUIT
+81 SET LP=1
+82 SET ADDTEXT="This indicates a clear need |for further assessment and clinical management."
+83 ;
+84 SET TEXT3=" This administration indicates presence of SUICIDAL IDEATION "
+85 ;q4=yes, q5=no
SET TEXT3A="WITH AT LEAST |SOME INTENT TO DIE in the past month. "
+86 ; patch 142
+87 SET TEXT3B="WITH |CONSIDERATION OF METHOD in the past month. "
+88 ;
+89 SET TEXT8=" ||This administration indicates presence of RECENT SUICIDAL BEHAVIOR. The |presence of ANY suicidal "
+90 SET TEXT8A="behavior (suicide attempt, interrupted attempt, |aborted attempt and preparatory behavior) "
+91 SET TEXT8B="in the past 3 months indicates |clear need for further assessment and clinical management."
+92 FOR
SET LP=$ORDER(^TMP($JOB,"YSCOR",LP))
if 'LP
QUIT
Begin DoDot:2
+93 ; Yes=1, No=2 and Skipped=0
+94 SET SCRE=$PIECE(^TMP($JOB,"YSCOR",LP),"=",2)
+95 SET SCORES=SCORES_SCRE
End DoDot:2
+96 ; get Suicidal Ideation in last month - question 1 and 2
+97 Begin DoDot:2
+98 IF $EXTRACT(SCORES,2)=1
SET YSDATA(N)="7771^9999;1^Yes - Suicidal thoughts"
SET N=N+1
QUIT
+99 IF ($EXTRACT(SCORES,1)=1)&($EXTRACT(SCORES,2)=2)
SET YSDATA(N)="7771^9999;1^Yes - Wish to die"
SET N=N+1
QUIT
+100 IF ($EXTRACT(SCORES,1)=2)&($EXTRACT(SCORES,2)=2)
SET YSDATA(N)="7771^9999;1^None endorsed"
SET N=N+1
QUIT
End DoDot:2
+101 ;
+102 ; get Method/plan/Intent in last month - question 3,4,5 and 6
+103 SET IEN=N
+104 Begin DoDot:2
+105 IF ($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=1)
SET YSDATA(N)="7772^9999;1^Method with specific plan and intent"
SET N=N+1
QUIT
+106 IF ($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=2)
SET YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent"
SET N=N+1
QUIT
+107 IF ($EXTRACT(SCORES,3)=1)&($EXTRACT(SCORES,4)=1)&($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=2)
SET YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent"
SET N=N+1
QUIT
+108 IF ($EXTRACT(SCORES,3)=1)&($EXTRACT(SCORES,4)=1)&($EXTRACT(SCORES,5)=2)
SET YSDATA(N)="7772^9999;1^Method with at least some intent and no specific plan"
SET N=N+1
QUIT
+109 IF ($EXTRACT(SCORES,3)=1)&($EXTRACT(SCORES,4)=2)&($EXTRACT(SCORES,5)=2)
SET YSDATA(N)="7772^9999;1^Method but with no specific plan or intent"
SET N=N+1
QUIT
+110 IF ($EXTRACT(SCORES,3)=2)&($EXTRACT(SCORES,4)=2)&($EXTRACT(SCORES,5)=2)
SET YSDATA(N)="7772^9999;1^No method, no specific plan, and no intent"
SET N=N+1
QUIT
+111 IF ($EXTRACT(SCORES,3)=2)&($EXTRACT(SCORES,4)=2)&($EXTRACT(SCORES,5)=1)
SET YSDATA(N)="7772^9999;1^Method with specific plan and no intent"
SET N=N+1
QUIT
+112 IF ($EXTRACT(SCORES,3)=2)&($EXTRACT(SCORES,4)=1)&($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=1)
SET YSDATA(N)="7772^9999;1^Method with specific plan and some intent"
SET N=N+1
QUIT
+113 IF ($EXTRACT(SCORES,3)=2)&($EXTRACT(SCORES,4)=1)&($EXTRACT(SCORES,5)=2)
SET YSDATA(N)="7772^9999;1^Method with at least some intent and no specific plan"
SET N=N+1
QUIT
+114 IF ($EXTRACT(SCORES,3)=0)&($EXTRACT(SCORES,4)=0)&($EXTRACT(SCORES,5)=0)
SET YSDATA(N)="7772^9999;1^No method, no specific plan, and no intent"
SET N=N+1
QUIT
End DoDot:2
IF '$DATA(YSDATA(IEN))
DO CSSRS(SCORES)
+115 ;
+116 ; get Sucidal Behavior based on question 7 and 8
+117 Begin DoDot:2
+118 IF ($EXTRACT(SCORES,8)=1)
SET YSDATA(N)="7773^9999;1^Recent Suicidal Behavior (<3 months)"
SET N=N+1
QUIT
+119 IF ($EXTRACT(SCORES,7)=1)&($EXTRACT(SCORES,8)=2)
SET YSDATA(N)="7773^9999;1^Past Suicidal Behavior (>3 Months)"
SET N=N+1
QUIT
+120 IF ($EXTRACT(SCORES,7)=2)
SET YSDATA(N)="7773^9999;1^No Past Suicidal Behavior Reported"
SET N=N+1
QUIT
End DoDot:2
+121 ;
+122 ;Key Indicators, in Question 7774
+123 SET STRNG=""
+124 IF ($EXTRACT(SCORES,3)=1)!($EXTRACT(SCORES,4)=1)!($EXTRACT(SCORES,5)=1)
Begin DoDot:2
+125 SET STRNG=TEXT3
+126 IF ($EXTRACT(SCORES,4)=1)!($EXTRACT(SCORES,5)=1)
SET STRNG=STRNG_TEXT3A
+127 IF ($EXTRACT(SCORES,3)=1)&($EXTRACT(SCORES,4)=2)&($EXTRACT(SCORES,5)=2)
SET STRNG=STRNG_TEXT3B
+128 SET STRNG=STRNG_ADDTEXT
End DoDot:2
+129 IF ($EXTRACT(SCORES,8)=1)
Begin DoDot:2
+130 SET STRNG=STRNG_TEXT8_TEXT8A_TEXT8B
End DoDot:2
+131 IF $LENGTH(STRNG)
SET YSDATA(N)="7774^9999;1^"_STRNG
+132 QUIT
End DoDot:1
QUIT
+133 ;
+134 ;dsb/BLD 3/1/2018 Complex Reporting for PSS-3
+135 IF TSTNM="PSS-3"
Begin DoDot:1
+136 NEW I,YSCORE,PTSD,SCORES,DEPSCORE,SUISCORE,SATTSCORE,SWHENSCORES,SWHENSCORE,YSPSS3
+137 SET SCORES=0
+138 SET N=N+1
+139 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+140 DO PSS3(.YSPSS3)
+141 IF ^TMP($JOB,"YSCOR",1)'="[DATA]"
QUIT
+142 SET DEPSCORE=$PIECE(^TMP($JOB,"YSCOR",2),"=",2)
+143 SET SUISCORE=$PIECE(^TMP($JOB,"YSCOR",3),"=",2)
+144 SET SATTSCORE=YSPSS3(7791)
+145 IF DEPSCORE=0
SET YSDATA(N)="7771^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Depressed Mood"
+146 IF DEPSCORE=1
SET YSDATA(N)="7771^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Depressed Mood"
+147 SET N=N+1
+148 IF SUISCORE=0
SET YSDATA(N)="7772^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Active Suicidal Ideation"
+149 IF SUISCORE=1
SET YSDATA(N)="7772^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Active Suicidal Ideation"
+150 SET N=N+1
+151 IF SATTSCORE=0
SET YSDATA(N+1)="7773^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Recent Suicide Attempt"
+152 IF $GET(SATTSCORE)
Begin DoDot:2
+153 SET SWHENSCORE=YSPSS3(7792)
+154 SET N=N+1
+155 IF SWHENSCORE>3
SET YSDATA(N)="7773^9999;1^The score for this administration is No, which indicates a NEGATIVE Screen for Recent Suicide Attempt"
+156 IF SWHENSCORE<4
SET YSDATA(N)="7773^9999;1^The score for this administration is Yes, which indicates a POSITIVE Screen for Recent Suicide Attempt"
End DoDot:2
+157 QUIT
End DoDot:1
QUIT
+158 ;
+159 ;bld/dsb 3/1/2018 Complex Reporting for WHODAS2.0-12
+160 IF TSTNM="WHODAS2.0-12"
Begin DoDot:1
+161 NEW I,PCT,LP,TOT,YSCORE
+162 SET (PCT,TOT)=0
+163 DO GETSCORE^YTQAPI8(.YSCORE,.YS)
+164 IF ^TMP($JOB,"YSCOR",1)'="[DATA]"
QUIT
+165 SET LP=1
+166 FOR
SET LP=$ORDER(^TMP($JOB,"YSCOR",LP))
if 'LP
QUIT
Begin DoDot:2
+167 SET TOT=TOT+$PIECE(^TMP($JOB,"YSCOR",LP),"=",2)
End DoDot:2
+168 SET YSDATA(N)="7771^9999;1^"_TOT
+169 QUIT
End DoDot:1
QUIT
+170 ;
+171 IF $LENGTH($TEXT(SPECIAL^YTQAPI2C))
DO SPECIAL^YTQAPI2C(TSTNM,.YSDATA,N,.YSAD,.YSTSTN)
QUIT
+172 QUIT
+173 ;
CSSRS(SCORES) ;logic for method/plan/intent section of CSSRS report
+1 ;
+2 IF ($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=1)
SET YSDATA(N)="7772^9999;1^Method with specific plan and at least some intent"
SET N=N+1
QUIT
+3 IF ($EXTRACT(SCORES,5)=1)&($EXTRACT(SCORES,6)=2)
SET YSDATA(N)="7772^9999;1^Method with specific plan and no intent"
SET N=N+1
QUIT
+4 ;
PSS3(YSPSS3) ;
+1 NEW YSQN,YSAI,YSAN,YSANS
+2 FOR YSQN=7791,7792
Begin DoDot:1
+3 SET YSAI=$ORDER(^YTT(601.85,"AC",YSAD,YSQN,0))
+4 if YSAI'>0
QUIT
+5 ;ASF 11/15/07
if '$DATA(^YTT(601.85,YSAI,0))
QUIT
+6 SET YSAN=""
+7 IF $PIECE(^YTT(601.85,YSAI,0),U,4)?1N.N
SET YSAN=$PIECE(^YTT(601.85,YSAI,0),U,4)
SET YSAN=$GET(^YTT(601.75,YSAN,1))
SET YSPSS3(YSQN)=YSAN
End DoDot:1
+8 ;
+9 IF YSPSS3(7791)="Yes"
SET YSPSS3(7791)=1
+10 IF '$TEST
SET YSPSS3(7791)=0
+11 SET YSANS=YSPSS3(7792)
+12 IF YSANS["Within the past 24 hours (including today)"
SET YSPSS3(7792)=1
QUIT
+13 IF YSANS["Within the last month (but not today)"
SET YSPSS3(7792)=2
QUIT
+14 IF YSANS["Between 1 and 6 months ago"
SET YSPSS3(7792)=3
QUIT
+15 IF YSANS["More than 6 months ago"
SET YSPSS3(7792)=4
QUIT
+16 IF '$TEST
SET YSPSS3(7792)=5
+17 QUIT