source: FOIAVistA/trunk/r/SURGERY-SR/SROERR1.m@ 1169

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

initial load of FOIAVistA 6/30/08 version

File size: 4.2 KB
Line 
1SROERR1 ;B'HAM/ADM - ORDER ENTRY ROUTINE ; 25 JUNE 1992 10:00 AM
2 ;;3.0; Surgery ;**109**;24 Jun 93
3 S DFN=+ORVP D DEM^VADPT S SRNAME=VADM(1),SRSSN=VA("PID"),SRAGE=ORAGE,SRWARD=$S($D(^DPT(DFN,.1)):^(.1),1:"NOT ENTERED")
4 S SROERR=SRTN D STATUS^SROERR0 K SROERR S SRSTAT=" "_SRSTATUS
5 S SRSS=$P(^SRF(SRTN,0),"^",4),SRSNM=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"UNKNOWN")
6 S SROSUR=$P(^SRF(SRTN,.1),"^",4),SROATT=$P(^(.1),"^",13)
7 S SROR=$P(^SRF(SRTN,0),"^",2),Y=$P(^SRF(SRTN,0),"^",9) D D^DIQ S SRSDATE=Y
8 S SROPER=$P(^SRF(SRTN,"OP"),"^") K SROP S (X,CNT)=0 F S X=$O(^SRF(SRTN,13,X)) Q:'X S CNT=CNT+1,SROP(CNT)=$P(^SRF(SRTN,13,X,0),"^")
9 K SROPS,MM,MMM S:$L(SROPER)<56 SROPS(1)=SROPER I $L(SROPER)>55 S SROPER=SROPER_" ",J=55 F M=1:1 D LOOP Q:MMM=""
10 S:SROSUR SROSUR=$P(^VA(200,SROSUR,0),"^") S SROATT=$S(SROATT:$P(^VA(200,SROATT,0),"^"),1:"NOT ENTERED")
11 S SRDIAG=$S($D(^SRF(SRTN,33)):$P(^(33),"^"),1:"") I SRDIAG="" S SRDIAG="NOT ENTERED"
12 S SR("1.0")=$G(^SRF(SRTN,"1.0")),A=$P(SR("1.0"),"^"),SRANES=$S(A="G":"GENERAL",A="L":"LOCAL",A="S":"SPINAL",A="B":"BLOCK",A="C":"CHOICE",A="MAC":"MONITORED ANES CARE",A="E":"EPIDURAL",1:"NOT ENTERED")
13 K SREST S (X,CNT)=0 F I=0:0 S X=$O(^SRF(SRTN,20,X)) Q:'X S CNT=CNT+1,Y=$P(^SRF(SRTN,20,X,0),"^"),SREST(CNT)=$P(^SRO(132.05,Y,0),"^")
14 K BLOOD S (CNT,X)=0 F I=0:0 S X=$O(^SRF(SRTN,11,X)) Q:'X S CNT=CNT+1,Y=$P(^SRF(SRTN,11,X,0),"^"),MM=$P(^(0),"^",2) S BLOOD(CNT)=Y_" "_MM_" UNITS" ;RLM
15 S SRLENGTH=$P($G(^SRF(SRTN,.4)),"^") I SRLENGTH="" S SRLENGTH="NOT ENTERED"
16 S SRORDER=$P(^SRF(SRTN,0),"^",11) I ORSTS=8 D SCHED
17 I $P($G(^SRF(SRTN,.2)),"^",2) D OPTM
18 I $P($G(^SRF(SRTN,30)),"^") S Y=$P(^(30),"^") D D^DIQ S SRCAN=Y,X=$P($G(^SRF(SRTN,31)),"^",8) I X S SREAS=$P(^SRO(135,X,0),"^")
19PRINT ;
20 I $E(IOST)="C" W @IOF,!,"Patient: "_SRNAME,?40,"ID#: "_VA("PID"),?65,"Age: "_SRAGE,!,"Ward: "_SRWARD,?40,"Surgical Case #"_SRTN_SRSTAT,! F LINE=1:1:80 W "-"
21 I $E(IOST)'="C" W !,"Ward: "_SRWARD,?40,"Surgical Case #"_SRTN_SRSTAT
22 W !,"Date of Operation: "_SRSDATE,?40,"Estimated Case Length: "_SRLENGTH
23 I ORSTS=8 W !,"Scheduled Start Time: "_SRST,?40,"Scheduled End Time: "_SRET
24 I ORSTS=1 W !,"Cancel Date: "_SRCAN,?34,"Cancel Reason: "_SREAS
25 I $P($G(^SRF(SRTN,.2)),"^",2) W !,"Time Operation Began: "_SRSTART,?40,"Time Operation Ended: "_SREND
26 I SROR W !,"Operating Room: "_$P(^SC($P(^SRS(SROR,0),"^"),0),"^")
27 W !!,"Surgical Specialty: "_SRSNM,!,"Surgeon: "_SROSUR,?40,"Attending: "_SROATT,!,"Preoperative Diagnosis: "_SRDIAG
28 W !!,"Principal Procedure:",?22,SROPS(1) I $D(SROPS(2)) W !,?22,SROPS(2) I $D(SROPS(3)) W !,?22,SROPS(3) I $D(SROPS(4)) W !,?22,SROPS(4) I $D(SROPS(5)) W !,?22,SROPS(5)
29 I $O(SROP(0)) W !,"Other Procedures:",?22,SROP(1) S CNT=1 F I=0:0 S CNT=$O(SROP(CNT)) Q:'CNT W !,?22,SROP(CNT)
30 I ORSTS=5,SRORDER'="" W !,"Case Schedule Order: "_SRORDER
31 W !,"Requested Anesthesia Technique: "_SRANES
32 I $O(BLOOD(0)) W !!,"Blood Requested: ",?18,BLOOD(1) I $D(BLOOD(2)) W !,?18,BLOOD(2) I $D(BLOOD(3)) W !,?18,BLOOD(3)
33 I $O(SREST(0)) W !,"Restraints: ",?18,SREST(1) I $D(SREST(2)) W ", "_SREST(2) I $D(SREST(3)) W ", "_SREST(3) I $D(SREST(4)) W ", "_SREST(4)
34 I $O(^SRF(SRTN,5,0)) W !!,"Comments: " S X=0 F I=0:0 S X=$O(^SRF(SRTN,5,X)) Q:'X W !,^SRF(SRTN,5,X,0)
35CON K SRSCON I $P($G(^SRF(SRTN,"CON")),"^") S SRSCON=$P(^("CON"),"^") K SROPS S SROPER=$P(^SRF(SRSCON,"OP"),"^") S:$L(SROPER)<80 SROPS(1)=SROPER I $L(SROPER)>79 S SROPER=SROPER_" ",J=79 F M=1:1 D LOOP Q:MMM=""
36 I $D(SRSCON) W !!,"Concurrent Case #"_SRSCON,!,SROPS(1) I $D(SROPS(2)) W !,SROPS(2) I $D(SROPS(3)) W !,SROPS(3)
37 Q
38LOOP ; break procedure if greater than J characters
39 S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<J S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
40 Q
41SCHED ; find scheduling times
42 S (SRST,Y)=$P($G(^SRF(SRTN,31)),"^",4) I Y D D^DIQ S SRFIND=$F(Y,":"),SRST=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
43 S (SRET,Y)=$P($G(^SRF(SRTN,31)),"^",5) I Y D D^DIQ S SRFIND=$F(Y,":"),SRET=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
44 Q
45OPTM ; find begin and end times
46 S (SRSTART,Y)=$P($G(^SRF(SRTN,.2)),"^",2) I Y D D^DIQ S SRFIND=$F(Y,":"),SRSTART=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
47 S (SREND,Y)=$P($G(^SRF(SRTN,.2)),"^",3) I Y D D^DIQ S SRFIND=$F(Y,":"),SREND=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
48 Q
Note: See TracBrowser for help on using the repository browser.