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

77 lines
4.4 KiB
Mathematica
Raw Normal View History

YSHX1 ;SLC/DKG-HISTORY OF PRESENT ILLNESS ;4/20/92 09:25 ;08/12/93 17:41
;;5.01;MENTAL HEALTH;**9**;Dec 30, 1994
;
; Called from the top by MENU option YSHX1
;
S YSHX="HX",P=","
1 ;
W ! D ^YSLRP G:YSDFN<1 END S YSDT=DT W @IOF,!!?3,"HISTORY PART ONE FOR ",YSNM," ",YSSEX," AGE ",YSAGE,!!
FN ;
D DTS G END:YSTOUT!YSUOUT K ^UTILITY($J,"W")
EL ;
W !!?3,"(E)nter" W:'YSNH "/Edit, (P)rint" R " OR (Q)uit: E// ",A1:DTIME S YSTOUT='$T,YSUOUT=A1["^" S:A1="" A1="E" S A1=$TR($E(A1),"epq","EPQ")
G END:YSTOUT!YSUOUT,ENT:A1="E",^YSHX1R:A1="P"&'YSNH,1:A1="Q",ELQ
ENT ;
S YSIDT=9999999-YSDT,YSCD=1,^PTX(YSDFN,YSHX,YSIDT,1,DUZ,1,YSCD,1,0)="",DIC="^PTX(YSDFN,YSHX,YSIDT,1,DUZ,1,YSCD,1,"
N DIWESUB S DIWESUB="Chief Complaint",DIWEPSE=1
W !!,"CHIEF COMPLAINT: "
D ENDTM^YSUTL S DWPK=1 D EN^DIWE
I '($D(^PTX(YSDFN,YSHX,YSIDT,1,DUZ,1,YSCD,1,1,0))#2) K ^PTX(YSDFN,YSHX,YSIDT,1,DUZ,1,YSCD,1,0) G HS
L +^PTX(YSDFN) S ^PTX(YSDFN,YSHX,YSIDT,1,DUZ,0)=DUZ,^(1,0)="^99.07D^1^1" S:'$D(^PTX(YSDFN,YSHX,YSIDT,1,DUZ,1,YSCD,0)) ^(0)=YSDTM L -^PTX(YSDFN)
HS ;
S ^PTX(YSDFN,YSHX,YSIDT,1,DUZ,2,YSCD,1,0)="",DIC="^PTX(YSDFN,YSHX,YSIDT,1,DUZ,2,YSCD,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10,"PREVIOUS HX1'S",!
YSIDT ;
S YSIDT=$O(^PTX(YSDFN,YSHX,YSIDT)) G:'YSIDT SEL S K=K+1,YSHD=9999999-YSIDT,(Y,A(K))=YSHD
D ENDD^YSUTL W !?8,$J(K,3)," ",Y G YSIDT
SEL ;
I K>1 G SL1
I K=1 W !?10,Y R " OK? Y// ",AA:DTIME S YSTOUT='$T,YSUOUT=AA["^"
G END:YSTOUT Q:YSUOUT
S AA=$TR(AA,"yn","YN") S:AA="" AA="Y" G:AA="?" SELQ1 G:AA["??" SELQ2 S AA=$E(AA) I AA="Y" S YSDT=A(K) Q
I K=1 S:"N"[AA YSNH=1 Q
I K=1 W:AA'["?" " ?",$C(7) G SELQ1
SL1 ;
W !!?3,"Select HX1 NUMBER: " R AB:DTIME S YSOUT='$T,YSUOUT=AB["^" I YSTOUT G END
Q:YSUOUT!(AB']"") G:AB["?" SL1Q I AB<1!(AB>K) G SL1
S YSDT=A(AB) Q
SELQ1 ;
W !!,"""YES"" = edit. ""N"" = new. Only one HX1 per day.",! K AA G SEL
SELQ2 ;
W !!,"""YES"" permits altering of previously entered information.",!,"""NO"" allows the addition of a new history - only 1 per day.",! K AA G SEL
SL1Q ;
W !!,"Enter number of HX1 you wish to edit OR a "" to enter a new HX1.",!,"Only one HX1 may be entered per day.",! G SL1
ELQ ;
W !!,"""E"" permits altering or addition of new HX1.",!,"""P"" produces a report.",!,"""Q"" exits option.",! G EL