source: FOIAVistA/tag/r/SURGERY-SR/SROARPT.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 6.7 KB
Line 
1SROARPT ;B'HAM ISC/MAM,ADM - ANESTHESIA REPORT ;10/21/04
2 ;;3.0; Surgery ;**100,134**;24 Jun 93
3 ;** NOTICE: This routine is part of an implementation of a nationally
4 ;** controlled procedure. Local modifications to this routine
5 ;** are prohibited.
6 ;
7 ; Reference to UPDATE^TIUSRVP supported by DBIA #3535
8 ; Reference to ES^TIUSROI supported by DBIA #3537
9 ;
10 I '$D(SRSITE) D ^SROVAR G:'$D(SRSITE) END S SRSITE("KILL")=1
11 I '$D(SRTN) K SRNEWOP D ^SROPS G:'$D(SRTN) END S SRTN("KILL")=1
12 N SRDIV,SRDO,SRFUNCT,SRHDR,SRINUSE,SRLEAVE,SRLOC,SRPARAM,SRPRINT,SRSEL,SRSINED,SRDTITL,SRTIU,SRXX
13 S SRDTITL="Anesthesia Report"
14 S (SRFUNCT,SRLEAVE,SRSINED)=0,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",4)
15 I SRTIU,$$STATUS^SROESUTL(SRTIU)=7 S SRSINED=1
16 D:SRSINED FUNCT D:'SRSINED EN
17ENF I 'SRLEAVE,SRFUNCT S SRSEL="" D FUNCT
18 D END
19 Q
20DISPLY I SRSINED S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",4) I SRTIU D PRNT^SROESPR(SRTN,SRTIU,SRDTITL) S SRLEAVE=1 Q
21 K %ZIS,IO("Q") S %ZIS="Q" D ^%ZIS I POP S SRLEAVE=1 Q
22 I $D(IO("Q")) K IO("Q") N ZTRTN,ZTDESC,ZTSAVE,ZTQUEUED S ZTRTN="PRNT^SROARPT",ZTDESC=SRDTITL,(ZTSAVE("SRTN"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD,^%ZISC Q
23EN D RPT^SROANR(SRTN) S DFN=$P(^SRF(SRTN,0),"^"),VAINDT=$P(^SRF(SRTN,0),"^",9)
24 S Y=$E(VAINDT,1,7) D D^DIQ S SRSDATE=Y D OERR^VADPT
25 S SRHDR=" "_VADM(1)_" ("_VA("PID")_") Case #"_SRTN_" - "_SRSDATE
26 S Y=$E($$NOW^XLFDT,1,12) D DD^%DT S SRPRINT="Printed: "_Y
27 S SRLOC=" Pt Loc: "_$P(VAIN(4),"^",2)_" "_VAIN(5)
28 S SRAGE="",Z=$P(VADM(3),"^") I Z S X=$E($P(^SRF(SRTN,0),"^",9),1,12),Y=$E(X,1,7),SRAGE=$E(Y,1,3)-$E(Z,1,3)-($E(Y,4,7)<$E(Z,4,7))
29 S SRPARAM=$$SITE^SROUTL0(SRTN) I SRPARAM S X=$P(^SRO(133,SRPARAM,0),"^"),SRDIV=$$EXTERNAL^DILFD(133,.01,"",X)
30 S SRDIV=$S(SRDIV'="":SRDIV,1:SRSITE("SITE"))
31 S SRINUSE=$P($G(^SRO(133,SRPARAM,.1)),"^",4)
32 U IO S (SRPAGE,SRSOUT)=0,$P(SRLINE,"-",80)="" D HDR
33 S SRI=0 F S SRI=$O(^TMP("SRANE",$J,SRTN,SRI)) Q:'SRI D Q:SRSOUT
34 .I $E(IOST)="P",$Y+11>IOSL D FOOT Q:SRSOUT D HDR
35 .I $E(IOST)'="P",$Y+4>IOSL D FOOT Q:SRSOUT D HDR
36 .W !,^TMP("SRANE",$J,SRTN,SRI)
37 I SRSOUT D ^%ZISC Q
38 D FOOT D D ^%ZISC
39 .I $D(SRALRT) S SRFUNCT=1 Q
40 .I '$G(SRFUNCT) S SRLEAVE=1
41 Q
42SRHDR S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT
43 S Y=$E($P(^SRF(SRTN,0),"^",9),1,7) D D^DIQ S SRSDATE=Y
44 S SRHDR=" "_VADM(1)_" ("_VA("PID")_") Case #"_SRTN_" - "_SRSDATE
45 Q
46PRNT N SRDIV,SRFUNCT,SRLEAVE D EN
47END K ^TMP("SRANE",$J)
48 W @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
49 D ^SRSKILL K VAIN,VAINDT I $D(SRSITE("KILL")) K SRSITE
50 I $D(SRTN("KILL")) K SRTN
51 Q
52PAGE I 'SRINUSE!'$D(^XUSEC("SROANES",DUZ)) D LAST Q
53 S (SRFUNCT,SRSOUT)=0
54 W ! K DIR S DIR(0)="FOA",DIR("A",1)=" Press <return> to continue, 'A' to access Anesthesia Report functions",DIR("A")=" or '^' to exit: " D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S (SRLEAVE,SRSOUT)=1 Q
55 I X="A"!(X="a") S (SRFUNCT,SRSOUT)=1
56 Q
57LAST W ! K DIR S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1
58 Q
59FOOT ; print footer
60 Q:SRSOUT I $E(IOST)'="P" D PAGE Q
61 I IOSL-9>$Y F X=$Y:1:(IOSL-10) W !
62 W !,SRLINE,!,VADM(1),?50,SRPRINT,!,VA("PID")_" Age: "_SRAGE,?50,SRLOC,!,SRDIV,?59,"Vice SF 509",!,SRLINE
63 Q
64HDR ; heading
65 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
66 S SRPAGE=SRPAGE+1 I $Y'=0 W @IOF
67 I $E(IOST)'="P",SRPAGE=1 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SRXX=VADM(1)_" ("_VA("PID")_")" W !,?(80-$L(SRXX)\2),SRXX
68 W:$E(IOST)="P" !!!!,SRLINE W !,?4,"MEDICAL RECORD ANESTHESIA REPORT - CASE #"_SRTN,?(79-$L("PAGE "_SRPAGE)),"PAGE "_SRPAGE,!
69 W:$E(IOST)="P" SRLINE,!
70 Q
71FUNCT ; anethesia report functions
72 D:'$D(SRHDR) SRHDR S SRSOUT=0,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",4)
73 I 'SRSINED,SRTIU,$$STATUS^SROESUTL(SRTIU)=7 S SRSINED=1
74 W:$Y>0 @IOF W !,SRHDR I SRSINED W !!," * * The Anesthesia Report has been electronically signed. * *"
75 W !!," Anesthesia Report Functions:",!
76 S DIR("A",1)=" 1. Edit report information",DIR("A",2)=" 2. Print/View report from beginning"
77 S DIR("A",3)=$S('SRTIU:"",'SRSINED:" 3. Sign the report electronically",1:"") I SRTIU,'SRSINED S DIR("A",4)=""
78 S DIR("A")="Select number: ",DIR("B")=2,DIR(0)="SAM^1:Edit report information;2:Print/View report from beginning"_$S(('SRSINED&SRTIU):";3:Sign the report electronically",1:"")
79 D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S (SRLEAVE,SRSOUT)=1 D END Q
80 S SRSEL=Y,SRDO=$S(SRSEL=1:"EDIT",SRSEL=3:"SIGN",1:"DISPLY")
81 D @SRDO D UNLOCK^SROUTL(SRTN)
82 S SRSOUT=0,SRFUNCT=1 D ENF
83 Q
84EDIT ; edit report data fields
85 D CHECK^SROES I SRSOUT Q
86 N SROLOCK,SRX,SRZ D ^SROLOCK I SROLOCK S Q3("VIEW")=""
87 N SRLCK S SRLCK=$$LOCK^SROUTL(SRTN) I 'SRLCK Q
88 K DA,DR,DIE S SRDTIME=DTIME,DTIME=3600,DIE=130,DA=SRTN,DR="[SROARPT]",ST="ANESTHESIA REPORT"_$S(SROLOCK:" **LOCKED",1:"") D EN2^SROVAR,^SRCUSS S DTIME=SRDTIME K Q3("VIEW")
89 I '$P(^SRF(SRTN,0),"^",20) D ^SROPCE1
90 I $D(SRODR) D ^SROCON1
91 S SROERR=SRTN D ^SROERR0
92 D EXIT^SROES
93 Q
94SIGN ; sign report if appropriate user
95 N SRTIU S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",4) I SRTIU,$$STATUS^SROESUTL(SRTIU)=7 W !!,"This report is already signed." H 2 Q
96 N SRLCK,SRESIG S SRESIG=1,SRLCK=$$LOCK^SROUTL(SRTN) I 'SRLCK Q
97 N SRA,SRMISS,SROK,X,Y S SROK=0,X=$G(^SRF(SRTN,.3)) F Y=1,2,3,4 I $P(X,"^",Y)=DUZ S SROK=1 Q
98 I 'SROK W !!,"Sorry, you are not authorized to sign this report." H 2 Q
99 S SRMISS=0 D ALLIN Q:SRSOUT!SRMISS
100ES D RPT^SROANR(SRTN)
101 N SRAY,SRERR,SRI,SRP,SRSIG,X1
102 S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",4)
103 D SIG^XUSESIG I X1="" W !!,"Signature failed." H 2 Q
104 F I=1:1 Q:'$D(^TMP("SRANE",$J,SRTN,I)) S SRAY("TEXT",I,0)=^TMP("SRANE",$J,SRTN,I)
105 S SRAY(.05)=5 D UPDATE^TIUSRVP(.SRERR,SRTIU,.SRAY,1) K SRAY
106 I +SRERR S SRSINED=1 D
107 .D ES^TIUSROI(SRTIU,DUZ)
108 .S XQAID="SRAR-"_SRTN,XQAKILL=0 D DELETEA^XQALERT
109 W ! K DIR S DIR(0)="FOA",DIR("A")="Press RETURN to continue... " D ^DIR K DIR
110 Q
111ALLIN N SRFLD,SRI,SRP,SRX,SRY,SRZ
112 K DA,DIC,DIQ,DR S (SREDIT,SRMISS,SRSOUT)=0
113 S DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="I",DR=".21;.24;1.13;.46;.31" D EN^DIQ1 K DA,DIC,DIQ,DR D LIST
114 K SRY,SRZ D TECH^SROPRIN I SRTECH="NOT ENTERED" D
115 .I $O(^SRF(SRTN,6,0)) S SRX(.37)="PRINCIPAL ANESTHESIA TECHNIQUE NOT SELECTED" Q
116 .S SRX(.37)="ANESTHESIA TECHNIQUE"
117 S SRZ=0 F S SRZ=$O(SRX(SRZ)) Q:'SRZ S SRMISS=1 Q
118 I SRMISS D MESS Q:SRSOUT D:SREDIT EDIT
119 Q
120MESS ; display list of missing items
121 W @IOF,!,"The following information is required before this report may be signed:",!
122 S SRZ=0 F S SRZ=$O(SRX(SRZ)) Q:'SRZ W !,?5,SRX(SRZ)
123 W ! K DIR S DIR("A")="Do you want to enter this information",DIR("B")="YES",DIR(0)="Y" D ^DIR K DIR,SRX I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
124 I Y S SREDIT=1
125 Q
126LIST S SRZ=0 F S SRZ=$O(SRY(130,SRTN,SRZ)) Q:'SRZ I SRY(130,SRTN,SRZ,"I")="" D TR S X=$T(@SRP),SRFLD=$P(X,";;",2),SRX(SRZ)=$P(SRFLD,"^",2)
127 Q
128TR S SRP=SRZ,SRP=$TR(SRP,"1234567890.","ABCDEFGHIJP")
129 Q
130PBA ;;.21^ANES CARE START TIME
131PBD ;;.24^ANES CARE END TIME
132APAC ;;1.13^ASA CLASS
133PDF ;;.46^OP DISPOSITION
134PCA ;;.31^PRINC ANESTHETIST
Note: See TracBrowser for help on using the repository browser.