Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: YIHISTF

YIHISTF.m

Go to the documentation of this file.
YIHISTF ;SLC/DKG-INTERVIEW HISTORY DRIVER (Cont) ; 10/18/88  13:40 ;
 ;;5.01;MENTAL HEALTH;;Dec 30, 1994
CK ;
 Q:'$T
CK1 ;
 S:P0 YSCON=1 D WAIT:'P0,ENFT^YSFORM:P0 Q:YSLFT  D HDR:P0 Q
L ;
 S Y1=$E(YSYTX,1,78-YSIND),Y2=$E(YSYTX,79-YSIND,255)
 I Y2="" X P1 D CK Q:YSLFT  W !?YSIND,Y1 Q
 F YSYI=78-YSIND:-1:1 I $E(Y1,YSYI)?1P X P1 D CK Q:YSLFT  W !?YSIND,$E(Y1,1,YSYI) S YSYTX=$E(Y1,YSYI+1,78-YSIND)_Y2 Q
 I $E(Y1,YSYI)'?1P X P1 D CK Q:YSLFT  W !?YSIND,Y1 S YSYTX=Y2
 G L
 ;
RP ;
 S J=1,U1=0,L=-200,YSLCK=200,YSFHDR=$P(^YTT(601,YSTEST,"P"),U,4),YSCON=0,YSFTR=$P(^YTT(601,YSTEST,"P"),U,5),YSLFT=0,YSFORM=1,YSXR="Patient Report"
 S P1=$S(IOST?1"C-".E:"I IOSL-$Y<3",1:"I IOSL-$Y<7"),P3=$S(P1[3:"I IOSL-$Y<6",1:"I IOSL-$Y<10"),P0=$S(P1[3:0,1:1) D HDR
R1 ;
 I '$D(^YTT(601,YSTEST,"G",J,1,1,0)) D PC,ENFT^YSFORM:P0 K A,B,D,DIW,DIWF,DIWL,DIWR,DIWT,DN,DW2,DWI,I,YSI,YSJ,YSU,YSXR,YSIND,J,L,YSLCK,R,YSSTEM,U1,YSYX,YSYCK,YSSCK Q
 S A=^YTT(601,YSTEST,"G",J,1,1,0),J=J+1,B=$P(A,U),I=+B,YSIND=$P(B,",",2)
 I I=0 G:$P(A,U,3)="OMIT" R1 X P3 D CK G:YSLFT END W !!?YSIND,$P(A,U,2),! S YSLCK=200 G R1
 I I'>L!(I>U1) S L=(I-1)\200*200,U1=L+200,YSYX=^YTD(601.2,YSDFN,1,YSET,1,YSED,U1\200)
 S R=$E(YSYX,I-L) G:R=" " R1
 S YSSTEM=$P(A,U,2) G:YSSTEM'["##" YSRP1 S YSSCK=$S(YSSTEM["2":2,YSSTEM["1":1,1:0) I YSSTEM["L" S YSLCK=YSIND,YSYCK=$P(A,U,3) G R1
 I YSSCK X P3 D CK G:YSLFT END
 W:YSSCK ! W !?YSIND,$P(A,U,3) W:YSSCK=2 ! G R1
YSRP1 ;
 I "YN"[R S R=R="N"+1 I YSSTEM'["#" S R=$P(A,U,R+1) G NOST:R'="",R1
 S R=$P(A,U,R+2) G R1:R="",NOST:YSSTEM=""
 D:YSIND>YSLCK STM G:YSLFT END
 I YSSTEM'["#" S YSYTX=YSSTEM_R D L G R1:'YSLFT,END
 S A=$F(YSSTEM,"#") I A<3 S YSYTX=R_$E(YSSTEM,2,99) D L G R1:'YSLFT,END
 S YSYTX=$E(YSSTEM,1,A-2)_R_$E(YSSTEM,A,99) D L G R1:'YSLFT,END
NOST ;
 D:YSIND>YSLCK STM G:YSLFT END S YSYTX=R D L G R1:'YSLFT,END
STM ;
 I YSSCK X P3 D CK Q:YSLFT
 W:YSSCK ! W !?YSLCK,YSYCK W:YSSCK=2 ! S YSLCK=200 Q
WH ;
 W !,$P(^YTT(601,YSTEST,0),U),"  QUESTION # ",J,! H 2 G @(R1)
HDR ;
 W @IOF I P0 W ! F I=1:1:80 W "-"
 I P0 W !,"MEDICAL RECORD"
 W ?(80-$L(YSFHDR)/2),YSFHDR I P0 W ! F I=1:1:80 W "-"
 I YSCON W !?25,"(Continued from previous page)" S YSCON=0
 W !?(80-$L(YSXR)\2),YSXR,":" Q
WAIT ;
 F I0=1:1:IOSL-$Y-2 W !
 N DTOUT,DUOUT,DIRUT
 S DIR(0)="E" D ^DIR K DIR S YSLFT=$D(DIRUT) W @IOF
 Q
END ;
 K P0,P1,P3,YSFHDR,YSCON,YSFTR,A,B,I,J,L,YSIND,YSLCK,R,YSSTEM,YSYX,YSYCK,YSSCK,Y1,Y2,YSYI,YSYTX Q
PC ;
 S YSXR="Staff Report" I $Y+$S(P0:10,1:5)>IOSL D CK1 Q:YSLFT
 E  W !!?34,YSXR
 S YSI=0 F  S YSI=$O(^YTD(601.2,YSDFN,1,YSET,1,YSED,"R","AD",YSI)) Q:'YSI  Q:YSLFT  S YSJ=0 F  S YSJ=$O(^YTD(601.2,YSDFN,1,YSET,1,YSED,"R","AD",YSI,YSJ)) Q:'YSJ  Q:'$D(^YTD(601.2,YSDFN,1,YSET,1,YSED,"R",YSJ,0))  S X=^(0) D PC1 Q:YSLFT
 K D,DIW,DIWF,DIWL,DIWR,DIWT,DN,DW2,DWI,I,YSI,YSJ,YSU Q
PC1 ;
 S YSU=$P(X,U,4) Q:YSU<1  D:$Y+$S(P0:11,1:6)>IOSL CK1 Q:YSLFT
 S Y=YSI D DD^%DT W !!,Y S DIC="^YTD(601.2,YSDFN,1,YSET,1,YSED,""R"",YSJ,1,",DIWL=1,DIWR=80,DIWF="W",DWI="F D=1:1:DW2 S X="_DIC_"D,0) D:$Y+$S(P0:12,1:7)>IOSL CK1 Q:YSLFT  D ^DIWP"
 S Z=DIC_"0)",DW2=$P(@(Z),U,4) D:$Y+$S(P0:10,1:5)>IOSL CK1 Q:YSLFT  W !! X DWI Q:YSLFT  D:$Y+$S(P0:11,1:5)>IOSL CK1 D ^DIWW D:$Y+$S(P0:10,1:4)>IOSL CK1 Q:YSLFT  W ! W:P0 !! W $P($G(^VA(200,+YSU,0)),U)
 I P0 W !,"NOT VALID UNLESS SIGNED - NOT TO BE FILED IN MEDICAL RECORD UNLESS SIGNED" Q