YTSIJSS ;SLC/BLD- MHAX ANSWERS SPECIAL HANDLING ;2/7/2018
;;5.01;MENTAL HEALTH;**123,147,224**;DEC 30,1994;Build 17
;
;
; Reference to $$GET1^DIQ in ICR #2056
;
Q
;
STRING ;
;
S YSDATA(N)="7771^9999;1^"_$P($P(^TMP($J,"YSCOR",2),"=",2),"^",2),N=N+1
S YSDATA(N)="7772^9999;1^"_$P($P(^TMP($J,"YSCOR",3),"=",2),"^",2),N=N+1
S YSDATA(N)="7773^9999;1^"_$P($P(^TMP($J,"YSCOR",4),"=",2),"^",2),N=N+1
S YSDATA(N)="7774^9999;1^"_$P($P(^TMP($J,"YSCOR",5),"=",2),"^",2),N=N+1
S YSDATA(N)="7775^9999;1^"_$P($P(^TMP($J,"YSCOR",6),"=",2),"^",2),N=N+1
S YSDATA(N)="7776^9999;1^"_$P($P(^TMP($J,"YSCOR",7),"=",2),"^",2),N=N+1
S YSDATA(N)="7777^9999;1^"_$P($P(^TMP($J,"YSCOR",8),"=",2),"^",2),N=N+1
Q
;set up a string varible you want displayed in your report.
REST2 ; setting up Report Question and Answer section; will move this to YSDATA so
N I
F I=1:1 Q:'$D(^YTT(601.72,YSQN,1,I,0)) D
.S TMP(NODE)=YSQN_U_"9999;1^"_DES_". "_$$GET1^DIQ(601.75,YSCDA_",",3,"E")_" ("_LEG_" points)"
Q
TRANS ; move Answers from TMP to YSDATA
N I,STR,ANS
F I=3:1 Q:'$D(YSDATA(I)) K YSDATA(I)
;
S ANS=7971 ;*************this is the first question - 1 as a starting point*****************
;
F I=3:1 Q:'$D(TMP(I))!(TMP(I)["999999999999") S STR=$P(TMP(I),U,2,4) D
.S ANS=ANS+1
.S YSDATA(I)=ANS_U_STR
Q
;
SCORESV ;
D DATA1
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)=$G(YSINSNAM)_" Scale not found"
S YSSCNAM=$P($G(^TMP($J,"YSG",3)),U,4) ; Scale Name
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
;
;S YSSCALIEN=1120 ;**************this needs to be changed to the current instrument scale***********
;
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,1121_",",3,"I")_"="_GENSAT_"^"_GENSATT
S ^TMP($J,"YSCOR",3)=$$GET1^DIQ(601.87,1122_",",3,"I")_"="_PAY_"^"_PAYT
S ^TMP($J,"YSCOR",4)=$$GET1^DIQ(601.87,1123_",",3,"I")_"="_ADVANCE_"^"_ADVANCET
S ^TMP($J,"YSCOR",5)=$$GET1^DIQ(601.87,1124_",",3,"I")_"="_SUPER_"^"_SUPERT
S ^TMP($J,"YSCOR",6)=$$GET1^DIQ(601.87,1125_",",3,"I")_"="_COWORKER_"^"_COWORKERT
S ^TMP($J,"YSCOR",7)=$$GET1^DIQ(601.87,1126_",",3,"I")_"="_HOW_"^"_HOWT
S ^TMP($J,"YSCOR",8)=$$GET1^DIQ(601.87,1120_",",3,"I")_"="_TOTAL_"^"_TOTALT
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N DATA,DES,LEG,NODE,YSQN,YSSCALIEN,TOTSCORE,TMP,TSTNM
N YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1
N TOTALT,GENSATT,PAYT,ADVANCET,SUPERT,COWORKERT,HOWT
N TOTAL,GENSAT,PAY,ADVANCE,SUPER,COWORKER,HOW,IJSS
S (TOTAL,GENSAT,PAY,ADVANCE,SUPER,COWORKER,HOW)=""
I '$D(N) N N S N=$O(YSDATA(""),-1) ; get last node
S N=N+1
;
; IJSS returns a scale score which is calculated and stored, no special text in report
I YSTRNG=1 D SCORESV
I YSTRNG=2 D
.D LDSCORES(.YSDATA,.YS)
.D STRING
;
Q
;
DATA1 ;
;
F I=3:1:7 S GENSAT=GENSAT+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
F I=8:1:11 S PAY=PAY+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
F I=12:1:14 S ADVANCE=ADVANCE+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
F I=15:1:19 S SUPER=SUPER+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
F I=20:1:26 S COWORKER=COWORKER+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
F I=27:1:34 S HOW=HOW+$$GET1^DIQ(601.75,$P(YSDATA(I),"^",3)_",",4,"I")
S GENSATT=$FN(GENSAT/5,"",2)
S PAYT=$FN(PAY/4,"",2)
S ADVANCET=$FN(ADVANCE/3,"",2)
S SUPERT=$FN(SUPER/5,"",2)
S COWORKERT=$FN(COWORKER/7,"",2)
S HOWT=$FN(HOW/8,"",2)
S TOTAL=(GENSATT+PAYT+ADVANCET+SUPERT+COWORKERT+HOWT)
S TOTALT=$FN(TOTAL/6,"",2)
;
Q
;
LDSCORES(YSDATA,YS) ; new call for patch 123
;input:AD = ADMINISTRATION #
;output: [DATA]
N G,N,IEN71,SCALE,YSAD,YSCODEN,YSCALE
S YSAD=$G(YS("AD"))
;
S YSDATA=$NA(^TMP($J,"YSCOR"))
S ^TMP($J,"YSCOR",1)="[DATA]",N=1
;
S YSCALE="",N=1
F S YSCALE=$O(^YTT(601.92,"AC",YSAD,YSCALE)) Q:'YSCALE D
.S G=$G(^YTT(601.92,YSCALE,0))
.S SCALE=$P(G,U,3),N=N+1
.S ^TMP($J,"YSCOR",N)=SCALE_"="_$P(G,U,4,7)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSIJSS 4110 printed Nov 22, 2024@17:29:53 Page 2
YTSIJSS ;SLC/BLD- MHAX ANSWERS SPECIAL HANDLING ;2/7/2018
+1 ;;5.01;MENTAL HEALTH;**123,147,224**;DEC 30,1994;Build 17
+2 ;
+3 ;
+4 ; Reference to $$GET1^DIQ in ICR #2056
+5 ;
+6 QUIT
+7 ;
STRING ;
+1 ;
+2 SET YSDATA(N)="7771^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",2),"=",2),"^",2)
SET N=N+1
+3 SET YSDATA(N)="7772^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",3),"=",2),"^",2)
SET N=N+1
+4 SET YSDATA(N)="7773^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",4),"=",2),"^",2)
SET N=N+1
+5 SET YSDATA(N)="7774^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",5),"=",2),"^",2)
SET N=N+1
+6 SET YSDATA(N)="7775^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",6),"=",2),"^",2)
SET N=N+1
+7 SET YSDATA(N)="7776^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",7),"=",2),"^",2)
SET N=N+1
+8 SET YSDATA(N)="7777^9999;1^"_$PIECE($PIECE(^TMP($JOB,"YSCOR",8),"=",2),"^",2)
SET N=N+1
+9 QUIT
+10 ;set up a string varible you want displayed in your report.
REST2 ; setting up Report Question and Answer section; will move this to YSDATA so
+1 NEW I
+2 FOR I=1:1
if '$DATA(^YTT(601.72,YSQN,1,I,0))
QUIT
Begin DoDot:1
+3 SET TMP(NODE)=YSQN_U_"9999;1^"_DES_". "_$$GET1^DIQ(601.75,YSCDA_",",3,"E")_" ("_LEG_" points)"
End DoDot:1
+4 QUIT
TRANS ; move Answers from TMP to YSDATA
+1 NEW I,STR,ANS
+2 FOR I=3:1
if '$DATA(YSDATA(I))
QUIT
KILL YSDATA(I)
+3 ;
+4 ;*************this is the first question - 1 as a starting point*****************
SET ANS=7971
+5 ;
+6 FOR I=3:1
if '$DATA(TMP(I))!(TMP(I)["999999999999")
QUIT
SET STR=$PIECE(TMP(I),U,2,4)
Begin DoDot:1
+7 SET ANS=ANS+1
+8 SET YSDATA(I)=ANS_U_STR
End DoDot:1
+9 QUIT
+10 ;
SCORESV ;
+1 DO DATA1
+2 ;-->out
IF $DATA(^TMP($JOB,"YSG",1))
IF ^TMP($JOB,"YSG",1)="[ERROR]"
Begin DoDot:1
+3 KILL ^TMP($JOB,"YSCOR")
+4 SET ^TMP($JOB,"YSCOR",1)="[ERROR]"
+5 SET ^TMP($JOB,"YSCOR",2)=$GET(YSINSNAM)_" Scale not found"
End DoDot:1
QUIT
+6 ; Scale Name
SET YSSCNAM=$PIECE($GET(^TMP($JOB,"YSG",3)),U,4)
+7 ;
+8 KILL ^TMP($JOB,"YSCOR")
+9 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+10 ;
+11 ;S YSSCALIEN=1120 ;**************this needs to be changed to the current instrument scale***********
+12 ;
+13 SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,1121_",",3,"I")_"="_GENSAT_"^"_GENSATT
+14 SET ^TMP($JOB,"YSCOR",3)=$$GET1^DIQ(601.87,1122_",",3,"I")_"="_PAY_"^"_PAYT
+15 SET ^TMP($JOB,"YSCOR",4)=$$GET1^DIQ(601.87,1123_",",3,"I")_"="_ADVANCE_"^"_ADVANCET
+16 SET ^TMP($JOB,"YSCOR",5)=$$GET1^DIQ(601.87,1124_",",3,"I")_"="_SUPER_"^"_SUPERT
+17 SET ^TMP($JOB,"YSCOR",6)=$$GET1^DIQ(601.87,1125_",",3,"I")_"="_COWORKER_"^"_COWORKERT
+18 SET ^TMP($JOB,"YSCOR",7)=$$GET1^DIQ(601.87,1126_",",3,"I")_"="_HOW_"^"_HOWT
+19 SET ^TMP($JOB,"YSCOR",8)=$$GET1^DIQ(601.87,1120_",",3,"I")_"="_TOTAL_"^"_TOTALT
+20 QUIT
+21 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW DATA,DES,LEG,NODE,YSQN,YSSCALIEN,TOTSCORE,TMP,TSTNM
+4 NEW YSCDA,YSSCNAM,YSINSNAM,STRING,STRING1
+5 NEW TOTALT,GENSATT,PAYT,ADVANCET,SUPERT,COWORKERT,HOWT
+6 NEW TOTAL,GENSAT,PAY,ADVANCE,SUPER,COWORKER,HOW,IJSS
+7 SET (TOTAL,GENSAT,PAY,ADVANCE,SUPER,COWORKER,HOW)=""
+8 ; get last node
IF '$DATA(N)
NEW N
SET N=$ORDER(YSDATA(""),-1)
+9 SET N=N+1
+10 ;
+11 ; IJSS returns a scale score which is calculated and stored, no special text in report
+12 IF YSTRNG=1
DO SCORESV
+13 IF YSTRNG=2
Begin DoDot:1
+14 DO LDSCORES(.YSDATA,.YS)
+15 DO STRING
End DoDot:1
+16 ;
+17 QUIT
+18 ;
DATA1 ;
+1 ;
+2 FOR I=3:1:7
SET GENSAT=GENSAT+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+3 FOR I=8:1:11
SET PAY=PAY+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+4 FOR I=12:1:14
SET ADVANCE=ADVANCE+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+5 FOR I=15:1:19
SET SUPER=SUPER+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+6 FOR I=20:1:26
SET COWORKER=COWORKER+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+7 FOR I=27:1:34
SET HOW=HOW+$$GET1^DIQ(601.75,$PIECE(YSDATA(I),"^",3)_",",4,"I")
+8 SET GENSATT=$FNUMBER(GENSAT/5,"",2)
+9 SET PAYT=$FNUMBER(PAY/4,"",2)
+10 SET ADVANCET=$FNUMBER(ADVANCE/3,"",2)
+11 SET SUPERT=$FNUMBER(SUPER/5,"",2)
+12 SET COWORKERT=$FNUMBER(COWORKER/7,"",2)
+13 SET HOWT=$FNUMBER(HOW/8,"",2)
+14 SET TOTAL=(GENSATT+PAYT+ADVANCET+SUPERT+COWORKERT+HOWT)
+15 SET TOTALT=$FNUMBER(TOTAL/6,"",2)
+16 ;
+17 QUIT
+18 ;
LDSCORES(YSDATA,YS) ; new call for patch 123
+1 ;input:AD = ADMINISTRATION #
+2 ;output: [DATA]
+3 NEW G,N,IEN71,SCALE,YSAD,YSCODEN,YSCALE
+4 SET YSAD=$GET(YS("AD"))
+5 ;
+6 SET YSDATA=$NAME(^TMP($JOB,"YSCOR"))
+7 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
SET N=1
+8 ;
+9 SET YSCALE=""
SET N=1
+10 FOR
SET YSCALE=$ORDER(^YTT(601.92,"AC",YSAD,YSCALE))
if 'YSCALE
QUIT
Begin DoDot:1
+11 SET G=$GET(^YTT(601.92,YSCALE,0))
+12 SET SCALE=$PIECE(G,U,3)
SET N=N+1
+13 SET ^TMP($JOB,"YSCOR",N)=SCALE_"="_$PIECE(G,U,4,7)
End DoDot:1
+14 QUIT