VistA-WorldVistAEHR/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTRPEXT.m

19 lines
1.1 KiB
Mathematica

YTRPEXT ;DALOI/YH-I/O FOR STAFF REMARKS ;8/22/2001
;;5.01;MENTAL HEALTH;**71**;Dec 30, 1994
;
ADDCOMM(RESULT,YSDATA,YSCOMMT) ;YTAPI SAVE TEST COMMENT
N YSDFN,YSET,YSED
S YSDFN=+$P(YSDATA,"^"),YSET=$P(YSDATA,"^",4),YSET=$O(^YTT(601,"B",YSET,0)),YSED=+$P(YSDATA,"^",3)
I '$D(^YTD(601.2,YSDFN,1,YSET,1,YSED)) S RESULT(1)="[ERROR]",RESULT(2)="No test found" Q
N YSAUTHOR,YSDUZ,YSDN,I S I=+$P(YSDATA,"^",6)
I I=0 S RESULT(1)="[ERROR]",RESULT(2)="No comment entered" Q
S YSAUTHOR=+$P(YSDATA,"^",2),YSDUZ=+$P(YSDATA,"^",5)
S:'$D(^YTD(601.2,YSDFN,1,YSET,1,YSED,"R",0)) ^(0)="^601.2213D^^" S DIC="^YTD(601.2,YSDFN,1,YSET,1,YSED,""R"",",DIC(0)="L",DLAYGO=601,X="T" D ^DIC G:Y<1 OUT S YSDN=+Y
S DIE=DIC,DA=+Y,DR="1///TODAY;2///`"_DUZ_";3///`"_YSAUTHOR,DA(3)=YSDFN,DA(2)=YSET,DA(1)=YSED L +^YTD(601.2,YSDFN):0 Q:'$T D ^DIE
S ^YTD(601.2,YSDFN,1,YSET,1,YSED,"R",YSDN,1,0)="^^"_I_"^"_I_"^"_$P(^YTD(601.2,YSDFN,1,YSET,1,YSED,"R",YSDN,0),"^",2)_"^"
N YS F YS=1:1:I S ^YTD(601.2,YSDFN,1,YSET,1,YSED,"R",YSDN,1,YS,0)=YSCOMMT(YS)
L -^YTD(601.2,YSDFN)
S RESULT(1)="[DATA]",RESULT(2)="Save ok"
Q
OUT S RESULT(1)="[ERROR]",RESULT(2)="Comment line not created" Q