VistA-FOIAVistA/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSHX1R.m

58 lines
2.9 KiB
Mathematica

YSHX1R ;SLC/DKG,SLC/TGA-HISTORY OF PRESENT ILLNESS REPORT ;11/19/90 16:30 ;08/12/93 17:25
;;5.01;MENTAL HEALTH;;Dec 30, 1994
;
; Called by routine YSHX1
S YSIDT=9999999-YSDT,%ZIS="Q" K IOP D ^%ZIS G:POP END^YSHX1
I $D(IO("Q")) S ZTRTN="ENPRINT^YSHX1R",ZTSAVE("YS*")="",ZTDESC="YS HX1 PRINT" D ^%ZTLOAD G END^YSHX1
ENPRINT ;
S YSP0=$S(IOST?1"P".E:1,1:0),YSPF=$S(YSP0:8,1:3),YSFHDR="History of Present Illness",YSFTR="SF 504",YSCON=0,YSLFT=0 U IO D ENHD^YSFORM
K YSUSN S YSPT=1 D FU S YSUS=0
CP1 ;
S YSUS=$O(YSUSN(YSUS)) G:'YSUS HP S YSUSER=$P(YSUSN(YSUS),U)
S DIC="^PTX(YSDFN,YSHX,YSIDT,1,YSUSER,YSPT,1,1,"
S DIWL=1,DIWR=80,DIWF="W",DWI="F D=1:1:DW2 S X="_DIC_"D,0) D:$Y+YSPF>IOSL CK Q:YSLFT D ^DIWP"
U IO D DT G:YSLFT END^YSHX1 W ?32,"CHIEF COMPLAINT:" D DIWP G:YSLFT END^YSHX1 D UNM G:YSLFT END^YSHX1 D:$Y+YSPF>IOSL CK G:YSLFT END^YSHX1 W ! G CP1
HP ;
K YSUSN S YSPT=2 D FU S YSUS=0
HP1 ;
S YSUS=$O(YSUSN(YSUS)) G:YSUS="" CM S YSUSER=$P(YSUSN(YSUS),U)
S DIC="^PTX(YSDFN,YSHX,YSIDT,1,YSUSER,YSPT,1,1,"
S DIWL=1,DIWR=80,DIWF="W",DWI="F D=1:1:DW2 S X="_DIC_"D,0) D:$Y+YSPF>IOSL CK Q:YSLFT D ^DIWP"
D DT G:YSLFT END^YSHX1 W ?27,"HISTORY OF PRESENT ILLNESS:" D DIWP G:YSLFT END^YSHX1 D UNM G:YSLFT END^YSHX1 D:$Y+YSPF>IOSL CK G:YSLFT END^YSHX1 W ! G HP1
CM ;
K YSUSN S YSPT=3 D FU S YSUS=0
CM1 ;
S YSUS=$O(YSUSN(YSUS)) G:'YSUS END S YSUSER=$P(YSUSN(YSUS),U)
S DIC="^PTX(YSDFN,YSHX,YSIDT,1,YSUSER,YSPT,1,1,"
S DIWL=1,DIWR=80,DIWF="W",DWI="F D=1:1:DW2 S X="_DIC_"D,0) D:$Y+YSPF>IOSL CK Q:YSLFT D ^DIWP"
D DT G:YSLFT END^YSHX1 W ?30,"CURRENT MEDICATIONS:" D DIWP G:YSLFT END^YSHX1 D UNM G:YSLFT END^YSHX1 W ! G CM1
END ;
D KILL^%ZTLOAD D ENFT^YSFORM:YSP0,WAIT:'YSP0 D ^%ZISC G END^YSHX1
FU ;
S YSUS=0,YSIDT=9999999-YSDT
NU ;
S YSUS=$O(^PTX(YSDFN,YSHX,YSIDT,1,YSUS)) Q:'YSUS S:$D(^(YSUS,YSPT,1,0)) YSTM=^(0),YSUSN(YSTM)=YSUS_U_YSTM G NU
S YSTM=$P(YSDC,U,2),YSUSN(YSTM)=YSUS G NU
UNM ;
D:$Y+YSPF+$S(YSP0:2,1:0)>IOSL CK Q:YSLFT S X=YSUSER D PSIG^YSUTL W ! W:YSP0 !! W Y Q
DT ;
S YSDTM=$P(YSUSN(YSUS),U,2),Y=$P(YSDTM,".") D ENDD^YSUTL S YSYD=$P(YSDTM,".",2),YSMN=$E(YSYD,3,4) S:$L(YSMN)=1 YSMN=YSMN_"0"
S YSHR=$E(YSYD,1,2),A=$S(YSHR<12:YSHR,YSHR>12:YSHR-12,YSHR=12:12,1:"00"),M=$S(YSHR<12:"A",YSHR>11:"P",1:0),YSTM=A_":"_YSMN_" "_M_"M"
D:$Y+YSPF+3>IOSL CK Q:YSLFT W !,YSDT(1)," at ",YSTM Q
DIWP ;
S YSREF=DIC_"0)" Q:'($D(@YSREF)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