SROANEST ;BIR/TJH - ANESTHESIA ENTRY ;01 Jun 2003 ;;3.0;Surgery;**119,150,152**;24 Jun 93 SINPUT ; N SRSTART S Z=$E($P(^SRF($S($D(SRTN):SRTN,1:DA(1)),0),"^",9),1,7),X=$S(X?1.4N.A!(X?1.2N1":"2N.A):Z_"@"_X,1:X) K %DT,Z S %DT="RTX" D ^%DT S X=Y K:Y<1 X I '$D(X),$G(SRFLAG)=1 D K SRFLAG Q .W !!,"Check date format.",!," Examples of Valid Dates:",!," JAN 20 1957 or 20 JAN 57 or 1/20/57 or 012057",!," T (for TODAY), T+1 (for TOMORROW), T+2, T+7, etc." .W !," T-1 (for YESTERDAY), T-3W (for 3 WEEKS AGO), etc.",!," If the year is omitted, the computer uses CURRENT YEAR. Two digit year" .W !," assumes no more than 20 years in the future, or 80 years in the past.",!," If only the time is entered, the current date is assumed." .W !," Follow the date with a time, such as JAN 20@10, T@10AM, 10:30, etc.",!," You may enter a time, such as NOON, MIDNIGHT or NOW." .W !," You may enter NOW+3' (for current date and time Plus 3 minutes",!," *Note--the Apostrophe following the number of minutes)" .W !," Time is REQUIRED in this response.",!," Enter the time a member of the Anesthesia staff begins preparing the",!," patient for surgery in the O.R. suite or if the care is interrupted, the" .W !," time the care resumes." Q:'$D(X) S SRSTART=$P($G(^SRF($S($D(SRTN):SRTN,1:DA(1)),.2)),"^",15) I SRSTART="" K SRFLAG Q I XSRCRET) W !!,"Start time is after current end time. Please correct." K X Q S SRSPREC=$O(^SRF(DA(1),50,DA(2)),-1) I SRSPREC'=0 D .S SRPET=$$GET1^DIQ(130.213,SRSPREC_","_DA(1)_",",1,"I") .I SRPET="" W !!,"New start time entry not permitted until previous end time is entered." K X Q .I SRPET>X W !!,"Start time is prior to previous end time. Please correct." K X I $D(X),(DA(2)=1) S SRTIME(130,DA(1)_",",.21)=X D FILE^DIE("","SRTIME","^TMP(""SR"",$J)") Q FINALT ; N SRCST,SRLET,SRYN,SRSNREC,SRFDA,SRTIME,SRLREC,SRCON I $D(^SRF(DA(1),"CON")),$P(^("CON"),"^") S SRCON=$P(^SRF(DA(1),"CON"),"^") S SRCST=$$GET1^DIQ(130.213,DA(2)_","_DA(1)_",",.01,"I") I XSRTDATE) K SRCASE(SRREC) Q S SRREC=0 F S SRREC=$O(SRCASE(SRREC)) Q:'SRREC D .S SRCASE=SRCASE(SRREC) .I $$GET1^DIQ(130,SRCASE,.214,"I")'=1 S SRRES=-2 Q .S SRDIAG=$P($G(^SRO(136,SRCASE,0)),"^",3) .I 'SRDIAG S SRDIAG=$P($G(^SRF(SRCASE,34)),"^",2) .S (SRAO,SREC,SRHNC,SRIR,SRMST,SRSHAD)=0 .S SR(0)=$G(^SRF(SRCASE,0)) .S SRSC=$P(SR(0),"^",16),SRAO=$P(SR(0),"^",17),SRIR=$P(SR(0),"^",18),SREC=$P(SR(0),"^",19),SRMST=$P(SR(0),"^",22),SRHNC=$P(SR(0),"^",23),SRCV=$P(SR(0),"^",24),SRSHAD=$P(SR(0),"^",25) .I '$D(^SRF(SRCASE,50)) S:SRRES'=1 SRRES=-2 Q .S SRRES=1,SRREC=0 .F S SRREC=$O(^SRF(SRCASE,50,SRREC)) Q:(SRREC="B")!(SRREC="") D ..S SRCST=$$GET1^DIQ(130.213,SRREC_","_SRCASE_",",.01,"I"),SRCET=$$GET1^DIQ(130.213,SRREC_","_SRCASE_",",1,"I") ..I 'SRCET K ^TMP("SRANES",$J,SRCASE) S SRRES=-2,SRREC="" Q ..S SRTTIME=0 D CALC ..S ^TMP("SRANES",$J,SRCASE,SRCST,SRCET)=SRDFN_"^"_SRTTIME_"^"_SRDIAG_"^"_SRSC_"^"_SRCV_"^"_SRAO_"^"_SRIR_"^"_SREC_"^"_SRMST_"^"_SRHNC_"^"_SRSHAD Q SRRES