source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSPTXR.m@ 861

Last change on this file since 861 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1YSPTXR ;SLC/DKG,SLC/TGA-TEXT FILE REPORTS ;5/30/91 09:25 ;
2 ;;5.01;MENTAL HEALTH;;Dec 30, 1994
3 ;
4 ; Called by routine YSPTX
5 S YSIDT=9999999-YSYDT I '$D(^PTX(YSDFN,YSTY,YSIDT)) S Y=YSYDT D ENDD^YSUTL W $C(7),!!!?3,"There are no ",YSFHDR,"s on ",Y,! H 1 G FN^YSPTX
6 S %ZIS="Q" K IOP D ^%ZIS G:POP END1^YSPTX
7 I $D(IO("Q")) S ZTRTN="ENPRINT^YSPTXR",ZTSAVE("YS*")="",ZTDESC="YS TEXT PRINT" D ^%ZTLOAD G END1^YSPTX
8ENPRINT ;
9 K ^UTILITY($J) S YSMOR=0 D INIT
10CP ;
11 K YSUSN D FU
12CP1 ;
13 S YSUS=$O(YSUSN(YSUS)) I YSUS="" G END:'YSMOR Q
14 S YSUSER=$P(YSUSN(YSUS),U),YSNT=$P(YSUSN(YSUS),U,3)
15 S DIC="^PTX(YSDFN,YSTY,YSIDT,1,YSUSER,1,YSNT,1,"
16 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"
17 U IO D DT G:YSLFT END1^YSPTX
18 D DIWP G:YSLFT END1^YSPTX D UNM G:YSLFT END1^YSPTX D:$Y+YSPF>IOSL CK G:YSLFT END1^YSPTX W ! G CP1
19END ;
20 D KILL^%ZTLOAD
21 D ENFT^YSFORM:YSP0,WAIT:'YSP0 D ^%ZISC G END1^YSPTX
22 ;
23FU ; Called by routine YSCEN33
24 S YSUS=0
25 F S YSUS=$O(^PTX(YSDFN,YSTY,YSIDT,1,YSUS)) Q:'YSUS S YSNT=0 D
26 .F S YSNT=$O(^PTX(YSDFN,YSTY,YSIDT,1,YSUS,1,YSNT)) Q:'YSNT S:$D(^PTX(YSDFN,YSTY,YSIDT,1,YSUS,1,YSNT,0)) YSTM=^(0) S:$D(YSUSN(YSTM)) YSTM=YSTM+.00001 S YSUSN(YSTM)=YSUS_U_YSTM_U_YSNT
27 Q
28UNM ;
29 D:$Y+YSPF+$S(YSP0:2,1:0)>IOSL CK Q:YSLFT S X=YSUSER D PSIG^YSUTL W ! W:YSP0 !! W Y Q
30DT ;
31 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"
32 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"
33 D:$Y+YSPF+3>IOSL CK Q:YSLFT W !,YSDT(1)," at ",YSTM Q
34DIWP ;
35 S Z=DIC_"0)",DW2=$P(@(Z),U,4) D:$Y+YSPF+1>IOSL CK Q:YSLFT W !! X DWI D ^DIWW Q
36 ;
37CK S:YSP0 YSCON=1 D ENFT^YSFORM:YSP0,WAIT:'YSP0 Q:YSLFT D:YSP0 ENHD^YSFORM Q
38WAIT ;
39 F I0=1:1:IOSL-$Y-4 W !
40 N DTOUT,DUOUT,DIRUT
41 W:$Y+1<IOSL ! S DIR(0)="E" D ^DIR K DIR S YSTOUT=$D(DTOUT),YSUOUT=$D(DUOUT) W @IOF
42 Q
43AD ; Called by routine YSPTX
44 S YSMOR=0 R !!?10,"ALL? Y// ",YSYN:DTIME S YSTOUT='$T,YSUOUT=YSYN["^" G:YSTOUT!YSUOUT END1^YSPTX S YSYN=$TR($E(YSYN),"yn","YN") G MOR:"Y"[YSYN I "N"'[YSYN W:YSYN'["?" " ?",$C(7) G AD
45RNG ;
46 W !!?3,"Begin ",YSFHDR," NUMBER: " R X:DTIME S YSTOUT='$T,YSUOUT=X["^" G END1^YSPTX:YSTOUT!YSUOUT,RNG:X["?" I '$D(A(+X)) W " ?",$C(7) G RNG
47THN ;
48 S YSYDT=A(X)+1,YSIDT=9999999-YSYDT W !?3,"Through ",YSFHDR," NUMBER: " R YSTHN:DTIME S YSTOUT='$T,YSUOUT=YSTHN["^" G END1^YSPTX:YSTOUT!YSUOUT I '$D(A(+YSTHN)) W:YSTHN'["?" " ?",$C(7) G THN
49 I X'<YSTHN S X1=X,X=YSTHN,YSTHN=X1,YSYDT=A(+X)+1,YSIDT=9999999-YSYDT K X1
50 S YSLDT=9999999-A(+YSTHN) G IHD
51MOR ;
52 S YSIDT=0
53IHD ;
54 K IOP S %ZIS="Q" D ^%ZIS G:POP END1^YSPTX I $D(IO("Q")) S ZTRTN="ENP2^YSPTXR",ZTSAVE("YS*")="",ZTDESC="YS TEXT PRINT 2" D ^%ZTLOAD G END1^YSPTX
55ENP2 ;
56 K ^UTILITY($J) S YSMOR=1 D INIT
57NIDT ;
58 S:'$D(YSLDT) YSLDT=9999999 S YSIDT=$O(^PTX(YSDFN,YSTY,YSIDT)) G:'YSIDT!(YSIDT>YSLDT) END
59 S YSYDT=9999999-YSIDT D CP Q:$G(YSLFT) G NIDT
60INIT ;
61 S (YSCON,YSLFT)=0,YSP0=$S(IOST?1"P".E:1,1:0),YSPF=$S(YSP0:8,1:3) U IO D ENHD^YSFORM
62 Q
63ENCN ; Called by routine YSLRP
64 S YSTL="CRISIS NOTE",YSTY="CN",YSMOR=1,(YSIDT,YSP0,YSLFT)=0,YSPF=3
65 W @IOF,!!?3,YSTL,"(S) FOR ",YSNM," ",YSSEX," AGE ",YSAGE W:'$D(^PTX(YSDFN,"CNU",DUZ)) $C(7) G NIDT
Note: See TracBrowser for help on using the repository browser.