125 lines
4.7 KiB
Mathematica
125 lines
4.7 KiB
Mathematica
YSASOL ;ASF/ALB- ASI ON-LINE ENTRY ;3/19/98 14:52
|
|
;;5.01;MENTAL HEALTH;**24,30,32,38**;Dec 30, 1994
|
|
MAIN(YSASPIEN,YSASSIEN) ;
|
|
Q:$G(YSASSIEN)'>0
|
|
Q:$G(YSASPIEN)'>0
|
|
D SCREENH^YSASA2
|
|
S YSASLL="",$P(YSASLL,"_",79)="" ;ASF 5/22
|
|
S YSIENS=YSASSIEN_","
|
|
S YSASTYP=$$GET1^DIQ(604,YSIENS,"CLASS")
|
|
S YSGP=$S(YSASTYP?1"L".E:5,YSASTYP?1"FO".E:6,1:4)
|
|
S DFN=YSASPIEN D DEM^VADPT S YSHDR1=VADM(1)_" "_$P(VADM(2),U,2) D KVAR^VADPT
|
|
S YSFILE=604,YSFLAG="EF",YSBACK=1 ;ASF 5/16
|
|
S YSFDA="^TMP($J,""YSASI"")"
|
|
K ^TMP($J,"YSASI")
|
|
S YSDFLAG=$$GET1^DIQ(604.8,"1,",.04)
|
|
S YSEFLAG=$$GET1^DIQ(604.8,"1,",.07)
|
|
S YSN=0,YSV=""
|
|
LOOP ;
|
|
F S YSN=$O(^YSTX(604.66,YSN)) Q:YSN'>0!(YSV="^") S YSENDLP=0 D L3
|
|
D HEAD
|
|
D FILE^DIE("K","^TMP($J,""YSASI"")")
|
|
WP ;
|
|
K DIRUT,DIR F Q:$D(DIRUT) D
|
|
. W !!?10,"*** Additional Areas ***",!,"1. Spiritual",!,"2. Leisure",!
|
|
. S DIR("A")="Enter Comment for? ",DIR(0)="SAO^1:Spiritual;2:Leisure" D ^DIR
|
|
. Q:$D(DIRUT)
|
|
. S DR=$S(Y=1:188,Y=2:187,1:"")
|
|
. S DA=YSASSIEN,DIE="^YSTX(604,"
|
|
. D ^DIE
|
|
. Q
|
|
;
|
|
D EN^YSASSN(YSASSIEN)
|
|
Q
|
|
L3 ;
|
|
S YSG=^YSTX(604.66,YSN,0),YSFIELD=+$P(YSG,U,3),YSQ=$P(YSG,U,2),YSDEF=$P(YSG,U,7),YSASENT=$P(YSG,U,9),YSASID=$P(YSG,U,11)
|
|
S YSASEX=$G(^YSTX(604.66,YSN,1))
|
|
Q:$P(YSG,U,YSGP)=""
|
|
;
|
|
Q:YSENDLP ;quit if executable sets flag
|
|
;
|
|
L4 ;No form feed
|
|
D FDAGET S YSP=Y
|
|
S:YSP=""!(YSP="^") YSP=$$GET1^DIQ(604,YSIENS,YSFIELD)
|
|
I YSP="",YSDFLAG="YES" S YSP=YSDEF ; SET DEFAULT IF FLAG SET
|
|
D DISP ;W !,YSQ,$S(YSP="":": ",1:": "_YSP_" // ")
|
|
L5 R YSV:DTIME S:'$T YSV="^"
|
|
S:YSV="" YSV=YSP
|
|
Q:YSV=""!(YSV="^")
|
|
I YSV?1"^"1A1N.E D Q:YSNN1'=0
|
|
. I YSV?1"^"1L.N S YSV="^"_$C($A(YSV,2)-32)_$E(YSV,3,9)
|
|
. S (YSNN,YSNN1)=0,YSBACK=YSN-.01 ;ASF 5/16
|
|
. S YSNN=$O(^YSTX(604.66,"C",$E(YSV,2,9)))
|
|
. Q:$E(YSNN,1,$L(YSV)-1)'=$E(YSV,2,9)
|
|
. S:$L(YSNN) YSNN1=$O(^YSTX(604.66,"C",YSNN,-1))
|
|
. S:YSNN1 YSN=YSNN1-.01
|
|
;
|
|
I YSV="^b"!(YSV="^B") S:$D(YSBACK) YSN=YSBACK Q ;ASF 5/16
|
|
I YSV="?" D DISPQ G L4
|
|
I YSV?1"??"."?" D G L5
|
|
.I YSFIELD'=.09,YSFIELD'=2,YSFIELD'=9.14,YSFIELD'=10.45,YSFIELD'=14.26,YSFIELD'=14.28 W $C(7)," No extended help available " Q
|
|
. I YSFIELD=2 D HEAD D D ANS
|
|
.. S DIC="^YSTX(604.26,",DIC(0)="FIS",D="B",DZ="??" D DQ^DICQ K DIC,DIE,DID,D,DIX,DO
|
|
. I YSFIELD=10.45 D HEAD D D ANS
|
|
.. S DIC="^YSTX(604.77,",DIC(0)="FIS",D="B",DZ="??" D DQ^DICQ K DIC,DIE,DID,D,DIX,DO
|
|
. I YSFIELD=14.26!(YSFIELD=14.28) D HEAD D D ANS
|
|
.. S DIC="^YSTX(604.3,",DIC(0)="FIS",D="B",DZ="??" D DQ^DICQ K DIC,DIE,DID,D,DIX,DO
|
|
. I YSFIELD=9.14 D HEAD D D ANS
|
|
.. S Y=0 F S Y=$O(^YSTX(604.68,3,1,Y)) Q:Y'>0 W !,^(Y,0)
|
|
. I YSFIELD=.09 D HEAD D
|
|
.. S DIC="^VA(200,",DIC(0)="AEQM",DIC("A")="Select Interviewer: "
|
|
.. D ^DIC S YSP=$S(+Y>0:$P(Y,U,2),1:"????") K DIC D ANS ;ASF 5/16
|
|
. Q
|
|
I YSV?1"^C".E!(YSV?1"^c".E) D G L4
|
|
. S DIE="^YSTX(604,",DA=YSASSIEN
|
|
. S DR=$S(YSASID?1"G".E:.6,YSASID?1"M".E:8.5,YSASID?1"E".E:9.5,YSASID?1"D".E:10.5,YSASID?1"L".E:14.5,YSASID?1"H".E:16.5,YSASID?1"F".E:18.5,YSASID?1"P".E:19.5,1:"")
|
|
. I DR D
|
|
.. D HEAD
|
|
. D ^DIE
|
|
;
|
|
S:YSV?1N.N YSV=+YSV ;ASF 5/16/97
|
|
D VAL
|
|
I YSA="^" W $C(7),"?? " G L5
|
|
W ?$X+3,YSA(0)
|
|
I YSEFLAG="YES" X YSASEX ; branch if parameters allowed
|
|
Q
|
|
VAL ;
|
|
D VAL^DIE(YSFILE,YSIENS,YSFIELD,YSFLAG,YSV,.YSA,YSFDA,"^TMP($J,""YSASERR"")")
|
|
Q
|
|
TEST D MAIN(1,30) Q
|
|
FDAGET ;
|
|
S Y=$$VALUE1^DILF(YSFILE,YSFIELD,YSFDA)
|
|
S:Y'=""&(Y'="^") Y=$$EXTERNAL^DILFD(YSFILE,YSFIELD,"",Y)
|
|
Q
|
|
DISP ;display question
|
|
D HEAD
|
|
W ?15,YSASRV1,YSASID,YSASRV0," "
|
|
W $S(YSASID?1"G".E:"General Information",YSASID?1"M".E:"Medical Status",YSASID?1"E".E:"Employment Status",YSASID?1"D".E:"Drug/Alcohol Status",YSASID?1"L".E:"Legal Status",1:"")
|
|
W $S(YSASID?1"P".E:"Psychiatric Status",YSASID?1"H".E:"Family History",YSASID?1"F".E:"Family/Social Relationships",1:"")
|
|
HINT ;
|
|
S DX=0,DY=20 X IOXY W YSASLL ;ASF 5/22
|
|
W !,$G(^YSTX(604.66,YSN,3,1,0)),!,$G(^YSTX(604.66,YSN,3,2,0))
|
|
W !,$E($G(^YSTX(604.66,YSN,3,3,0)),1,50),?62,YSASRV1,"Enter ? for help",YSASRV0
|
|
S DX=0,DY=3 X IOXY
|
|
W YSASRV1 S J=0 F S J=$O(^YSTX(604.66,YSN,2,J)) Q:J'>0 W !,$S(J=1&($P(^YSTX(604.66,YSN,0),U,10)=1)&(YSASTYP="FOLLOWUP"):"* ",1:""),^YSTX(604.66,YSN,2,J,0)
|
|
W YSASRV0
|
|
I YSFIELD>3,YSFIELD'=10.45,YSFIELD'=14.26,YSFIELD'=14.28,$P(^DD(604,YSFIELD,0),U,2)?.E1"P".E D
|
|
. S YSATRIB=$P(^DD(604,YSFIELD,0),U,3) ;$$GET1^DID(YSFILE,YSFIELD,"","POINTER")
|
|
. S DIC="^"_YSATRIB,DIC(0)="FIS",D="B",DZ="??" D DQ^DICQ K DIC,DIE,DID,D,DIX,DO
|
|
E I YSFIELD'=9.14 W ! D HELP^DIE(604,"",YSFIELD,"?"),MSG^DIALOG("HW") W !
|
|
I YSFIELD=9.14 W !!!,^DD(604,YSFIELD,3),!
|
|
;
|
|
ANS W:$Y<10 !
|
|
W !,YSASID_" Answer",$S(YSP="":": ",1:": "_YSP_" // ")
|
|
Q
|
|
DISPQ ;????
|
|
D HEAD
|
|
D EN^DDIOL("","^YSTX(604.68,21,1)")
|
|
S DX=0,DY=22 X IOXY K DIR S DIR(0)="E" D ^DIR
|
|
Q
|
|
HEAD ;
|
|
W @IOF,IOHOME,IOEDEOP
|
|
W YSHDR1,?45,"Addiction Severity Index ",YSASRV1,YSASTYP,YSASRV0,!
|
|
W YSASLL,! ;ASF 5/22
|
|
Q
|