YTSPSOCQ ;SLC/LLH - Move PSOCQ Score to complex ; 07/16/2018
;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
;
;Public, Supported ICRs
; #2056 - Fileman API - $$GET1^DIQ
;
Q
;
DATA1 ;
S YSINSNAM=$P($G(YSDATA(2)),U,3)
I $G(YSINSNAM)="" S YSINSNAM=$G(YS("CODE"),"NO NAME PASSED")
S NODE=2 F S NODE=$O(YSDATA(NODE)) Q:NODE="" D ; Start at YSDATA(3)
.S DATA=YSDATA(NODE)
.S YSQN=$P(DATA,U,1)
.S YSCDA=$P($G(DATA),U,3)
.D DESGNTR^YTSCORE(YSQN,.DES)
.S LEG=$S(YSCDA=780:1,YSCDA=782:2,YSCDA=999:3,YSCDA=783:4,YSCDA=785:5,1:"")
.D SCORE
Q
;
SCORE ;
I "^6536^6537^6538^6539^6540^6541^6542^"[(U_YSQN_U) S STG(928)=STG(928)+LEG
I "^6543^6544^6545^6546^6547^6548^6549^6550^6551^6552^"[(U_YSQN_U) S STG(929)=STG(929)+LEG
I "^6553^6554^6555^6556^6557^6558^"[(U_YSQN_U) S STG(930)=STG(930)+LEG
I "^6560^6561^6562^6563^6564^6565^6566^"[(U_YSQN_U) S STG(931)=STG(931)+LEG
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)=$G(YSINSNAM)_" Scales not found"
;
K ^TMP($J,"YSCOR")
S ^TMP($J,"YSCOR",1)="[DATA]"
S ^TMP($J,"YSCOR",2)=$$GET1^DIQ(601.87,928_",",3,"I")_"="_$J((STG(928)/7),0,2) ;Precontemplation
S ^TMP($J,"YSCOR",3)=$$GET1^DIQ(601.87,929_",",3,"I")_"="_$J((STG(929)/10),0,2) ;Contemplation
S ^TMP($J,"YSCOR",4)=$$GET1^DIQ(601.87,930_",",3,"I")_"="_$J((STG(930)/6),0,2) ;Action
S ^TMP($J,"YSCOR",5)=$$GET1^DIQ(601.87,931_",",3,"I")_"="_$J((STG(931)/7),0,2) ;Maintenance
Q
;
DLLSTR(YSDATA,YS,YSTRNG) ;
; YSTRNG = 1 Score Instrument
; YSTRNG = 2 get Report Answers and Text
N I,DATA,DES,LEG,NODE,YSQN
N YSCDA,YSSCNAM,YSINSNAM,STG
;
F I=928:1:931 S STG(I)=0
; PSOCQ returns a scale score which is calculated and stored, no special text in report
I YSTRNG=2 Q
;
S STAGE=1
D DATA1
D SCORESV
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYTSPSOCQ 1892 printed Dec 13, 2024@02:20:41 Page 2
YTSPSOCQ ;SLC/LLH - Move PSOCQ Score to complex ; 07/16/2018
+1 ;;5.01;MENTAL HEALTH;**123**;DEC 30,1994;Build 73
+2 ;
+3 ;Public, Supported ICRs
+4 ; #2056 - Fileman API - $$GET1^DIQ
+5 ;
+6 QUIT
+7 ;
DATA1 ;
+1 SET YSINSNAM=$PIECE($GET(YSDATA(2)),U,3)
+2 IF $GET(YSINSNAM)=""
SET YSINSNAM=$GET(YS("CODE"),"NO NAME PASSED")
+3 ; Start at YSDATA(3)
SET NODE=2
FOR
SET NODE=$ORDER(YSDATA(NODE))
if NODE=""
QUIT
Begin DoDot:1
+4 SET DATA=YSDATA(NODE)
+5 SET YSQN=$PIECE(DATA,U,1)
+6 SET YSCDA=$PIECE($GET(DATA),U,3)
+7 DO DESGNTR^YTSCORE(YSQN,.DES)
+8 SET LEG=$SELECT(YSCDA=780:1,YSCDA=782:2,YSCDA=999:3,YSCDA=783:4,YSCDA=785:5,1:"")
+9 DO SCORE
End DoDot:1
+10 QUIT
+11 ;
SCORE ;
+1 IF "^6536^6537^6538^6539^6540^6541^6542^"[(U_YSQN_U)
SET STG(928)=STG(928)+LEG
+2 IF "^6543^6544^6545^6546^6547^6548^6549^6550^6551^6552^"[(U_YSQN_U)
SET STG(929)=STG(929)+LEG
+3 IF "^6553^6554^6555^6556^6557^6558^"[(U_YSQN_U)
SET STG(930)=STG(930)+LEG
+4 IF "^6560^6561^6562^6563^6564^6565^6566^"[(U_YSQN_U)
SET STG(931)=STG(931)+LEG
+5 QUIT
+6 ;
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)=$GET(YSINSNAM)_" Scales not found"
End DoDot:1
QUIT
+5 ;
+6 KILL ^TMP($JOB,"YSCOR")
+7 SET ^TMP($JOB,"YSCOR",1)="[DATA]"
+8 ;Precontemplation
SET ^TMP($JOB,"YSCOR",2)=$$GET1^DIQ(601.87,928_",",3,"I")_"="_$JUSTIFY((STG(928)/7),0,2)
+9 ;Contemplation
SET ^TMP($JOB,"YSCOR",3)=$$GET1^DIQ(601.87,929_",",3,"I")_"="_$JUSTIFY((STG(929)/10),0,2)
+10 ;Action
SET ^TMP($JOB,"YSCOR",4)=$$GET1^DIQ(601.87,930_",",3,"I")_"="_$JUSTIFY((STG(930)/6),0,2)
+11 ;Maintenance
SET ^TMP($JOB,"YSCOR",5)=$$GET1^DIQ(601.87,931_",",3,"I")_"="_$JUSTIFY((STG(931)/7),0,2)
+12 QUIT
+13 ;
DLLSTR(YSDATA,YS,YSTRNG) ;
+1 ; YSTRNG = 1 Score Instrument
+2 ; YSTRNG = 2 get Report Answers and Text
+3 NEW I,DATA,DES,LEG,NODE,YSQN
+4 NEW YSCDA,YSSCNAM,YSINSNAM,STG
+5 ;
+6 FOR I=928:1:931
SET STG(I)=0
+7 ; PSOCQ returns a scale score which is calculated and stored, no special text in report
+8 IF YSTRNG=2
QUIT
+9 ;
+10 SET STAGE=1
+11 DO DATA1
+12 DO SCORESV
+13 QUIT