source: FOIAVistA/trunk/r/SURGERY-SR/SRONIN.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 8.9 KB
Line 
1SRONIN ;BIR/MAM,ADM - NURSE INTRAOPERATIVE REPORT ;05/30/06
2 ;;3.0; Surgery ;**68,50,100,129,134,153,157**;24 Jun 93;Build 3
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 ; Reference to EXTRACT^TIULQ supported by DBIA #2693
10 ;
11 I '$D(SRSITE) D ^SROVAR G:'$D(SRSITE) END S SRSITE("KILL")=1
12 I '$D(SRTN) K SRNEWOP D ^SROPS G:'$D(SRTN) END S SRTN("KILL")=1
13 N SRAGE,SRDIV,SRDIVNM,SRDO,SRFUNCT,SRHDR,SRINUSE,SRLEAVE,SRLOC,SRPARAM,SRPRINT,SRSEL,SRSINED,SRDTITL,SRTIU,SRAT,SRXX
14 S SRDTITL="Nurse Intraoperative Report"
15 S (SRFUNCT,SRLEAVE,SRSINED)=0,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2)
16 I SRTIU,$$STATUS^SROESUTL(SRTIU)=7 S SRSINED=1
17 D:SRSINED FUNCT D:'SRSINED EN
18ENF I 'SRLEAVE,SRFUNCT S SRSEL="" D FUNCT
19 D END
20 Q
21DISPLY I SRSINED S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2) I SRTIU D PRNT^SROESPR(SRTN,SRTIU,SRDTITL) S SRLEAVE=1 Q
22 K %ZIS,IO("Q") S %ZIS="Q" D ^%ZIS I POP S SRLEAVE=1 Q
23 I $D(IO("Q")) K IO("Q") N ZTRTN,ZTDESC,ZTSAVE,ZTQUEUED S ZTRTN="PRNT^SRONIN",ZTDESC=SRDTITL,(ZTSAVE("SRTN"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD,^%ZISC Q
24EN D RPT^SRONRPT(SRTN) S DFN=$P(^SRF(SRTN,0),"^"),VAINDT=$P(^SRF(SRTN,0),"^",9)
25 S Y=$E(VAINDT,1,7) D D^DIQ S SRSDATE=Y D OERR^VADPT
26 S SRHDR=" "_VADM(1)_" ("_VA("PID")_") Case #"_SRTN_" - "_SRSDATE
27 S Y=$E($$NOW^XLFDT,1,12) D DD^%DT S SRPRINT="Printed: "_Y
28 S SRLOC=" Pt Loc: "_$P(VAIN(4),"^",2)_" "_VAIN(5)
29 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))
30 S SRDIV=$$SITE^SROUTL0(SRTN),SRDIVNM="" I SRDIV S X=$P(^SRO(133,SRDIV,0),"^"),SRDIVNM=$$EXTERNAL^DILFD(133,.01,"",X)
31 S SRDIVNM=$S(SRDIVNM'="":SRDIVNM,1:SRSITE("SITE"))
32 U IO S (SRPAGE,SRSOUT)=0,$P(SRLINE,"-",80)="" D HDR
33 S SRI=0 F S SRI=$O(^TMP("SRNIR",$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("SRNIR",$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("SRNIR",$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 $D(SRNOEDIT) 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 Nurse Intraoperative Report",DIR("A")=" functions, 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,!,SRDIVNM,?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 !,?3,"MEDICAL RECORD NURSE INTRAOPERATIVE REPORT - CASE #"_SRTN,?(79-$L("PAGE "_SRPAGE)),"PAGE "_SRPAGE,!
69 W:$E(IOST)="P" SRLINE,!
70 Q
71FUNCT ; nurse intraop report functions
72 K SRALRT
73 D:'$D(SRHDR) SRHDR S SRSOUT=0,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2)
74 I 'SRSINED,SRTIU,$$STATUS^SROESUTL(SRTIU)=7 S SRSINED=1
75 W @IOF,!,SRHDR I SRSINED W !!," * * The Nurse Intraoperative Report has been electronically signed. * *"
76 W !!," Nurse Intraoperative Report Functions:",!
77 S DIR("A",1)=" 1. Edit report information",DIR("A",2)=" 2. Print/View report from beginning"
78 S DIR("A",3)=$S('SRTIU:"",'SRSINED:" 3. Sign the report electronically",1:"") I SRTIU,'SRSINED S DIR("A",4)=""
79 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:"")
80 D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S (SRLEAVE,SRSOUT)=1 D END Q
81 S SRSEL=Y,SRDO=$S(SRSEL=1:"EDIT",SRSEL=3:"SIGN",1:"DISPLY")
82 D @SRDO D UNLOCK^SROUTL(SRTN)
83 S SRSOUT=0,SRFUNCT=1 D ENF
84 Q
85EDIT ; edit report data fields
86 D CHECK^SROES I SRSOUT Q
87 N SROLOCK,SRX,SRZ D ^SROLOCK I SROLOCK S Q3("VIEW")=""
88 N SRLCK S SRLCK=$$LOCK^SROUTL(SRTN) I 'SRLCK Q
89 K DA,DR,DIE S SRDTIME=DTIME,DTIME=3600,DIE=130,DA=SRTN,DR="[SRONRPT]",ST="NURSE INTRAOP"_$S(SROLOCK:" **LOCKED",1:"") D EN2^SROVAR,^SRCUSS S DTIME=SRDTIME K Q3("VIEW")
90 I '$P(^SRF(SRTN,0),"^",20) D ^SROPCE1
91 I $D(SRODR) D ^SROCON1
92 S SROERR=SRTN D ^SROERR0
93 D EXIT^SROES
94 Q
95SIGN ; sign report if appropriate user
96 N SRLCK,SRESIG S SRESIG=1,SRLCK=$$LOCK^SROUTL(SRTN) I 'SRLCK Q
97 N SRMISS,SRNUR,SROK,SRA,SRII,SRJ,Y S SRII=$P($G(^SRF(SRTN,"TIU")),"^",2)
98 S (SROK,SRNUR,SRJ)=0 F S SRNUR=$O(^SRF(SRTN,19,SRNUR)) Q:'SRNUR S SRJ=1 I $P(^SRF(SRTN,19,SRNUR,0),"^")=DUZ S SROK=1 Q
99 I $D(^XUSEC("SROCHIEF",DUZ)) S SROK=1
100 I 'SROK,'SRJ,SRII D EXTRACT^TIULQ(SRII,"SRA",.SRERR,"1302") I +$G(SRA(SRII,1302,"I"))=DUZ S SROK=1
101 I 'SROK W !!,"Sorry, you are not authorized to sign this report." H 2 Q
102 S SRMISS=0 D ALLIN Q:SRSOUT!SRMISS
103ES D RPT^SRONRPT(SRTN) N SRAY,SRERR,SRI,SRP,SRSIG,SRTIU,X1
104 S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2)
105 D SIG^XUSESIG I X1="" W !!,"Signature failed." H 2 Q
106 F I=1:1 Q:'$D(^TMP("SRNIR",$J,SRTN,I)) S SRAY("TEXT",I,0)=^TMP("SRNIR",$J,SRTN,I)
107 S SRAY(.05)=5 D UPDATE^TIUSRVP(.SRERR,SRTIU,.SRAY,1) K SRAY
108 I +SRERR S SRSINED=1 D
109 .D ES^TIUSROI(SRTIU,DUZ)
110 .S XQAID="SRNIR-"_SRTN,XQAKILL=0 D DELETEA^XQALERT
111 W ! K DIR S DIR(0)="FOA",DIR("A")="Press RETURN to continue... " D ^DIR K DIR
112 Q
113ALLIN N SRFLD,SRI,SRJJ,SRJK,SRM,SRMISS1,SRMISS2,SRMISS3,SRMISS82,SRMISS83,SRMISS84,SRMIS508,SRO,SROO,SRP,SRX,SRY,SRZ
114 K DA,DIC,DIQ,DR S (SREDIT,SRMISS,SRMISS1,SRMISS2,SRMISS3,SRMISS82,SRMISS83,SRMISS84,SRMIS508,SRSOUT)=0
115 S DIC="^SRF(",DA=SRTN,DIQ="SRY",DIQ(0)="I",DR=".205;.232;44;45;46;47;48;71;72;73;506" D EN^DIQ1
116 F SRJJ=82,83,84,49 I '$O(^SRF(SRTN,SRJJ,0)) S SRJK=$S(SRJJ=49:508,1:SRJJ),SRY(130,SRTN,SRJK,"I")=""
117 I $O(^SRF(SRTN,1,0)) S SRO=0 F S SRO=$O(^SRF(SRTN,1,SRO)) Q:'SRO S SROO=$G(^SRF(SRTN,1,SRO,2)) D
118 .F SRM=1,2,3 S:$P(SROO,"^",SRM)']"" SRY(130.47,SRTN,SRO_";"_(SRM+7),"I")=""
119 K DA,DIC,DIQ,DR D LIST
120 I $G(SRX(.205))'=""!($G(SRX(.232))'="")!($G(SRX(71))'="")!($G(SRX(72))'="")!($G(SRX(73))'="")!($G(SRX(506))'="") S SRMISS1=1
121 F SRJJ=71,72,73 I (SRY(130,SRTN,SRJJ,"I")="N")!(SRY(130,SRTN,SRJJ,"I")=""),('$O(^SRF(SRTN,SRJJ+11,0))) S @("SRMISS"_(SRJJ+11))=1
122 I SRY(130,SRTN,506,"I")="S"!(SRY(130,SRTN,506,"I")="O"),('$O(^SRF(SRTN,49,0))) S SRMIS508=1
123 I $G(SRX(48))="" F SRZ=44,45,46,47 I $G(SRX(SRZ))'="" S SRMISS2=1 Q
124 I $O(^SRF(SRTN,1,0)) F SRZ=8,9,10 I $O(SRX(130.47,0)) S SRMISS3=1 Q
125 I SRMISS1!SRMISS2!$G(SRMISS82)!$G(SRMISS83)!$G(SRMISS84)!$G(SRMIS508)!(SRMISS3) S SRMISS=1 D MESS Q:SRSOUT I SREDIT D EDIT Q
126 Q
127MESS ; display list of missing items
128 W @IOF,!,"The following information is required before this report may be signed:",!
129 I SRMISS1 F SRZ=.205,.232,71,72,73,506 I $G(SRX(SRZ))'="" W !,?5,SRX(SRZ)
130 I SRMISS2 F SRZ=44:1:47 I $G(SRX(SRZ))'="" W !,?5,SRX(SRZ)
131 F SRJJ=82,83,84 I $G(@("SRMISS"_SRJJ)),$G(SRX(SRJJ))'="" W !,?5,SRX(SRJJ)
132 I $G(SRMIS508),$G(SRX(508))'="" W !,?5,SRX(508)
133 I SRMISS3 I $O(SRX(130.47,0)) S SRJ=0 F S SRJ=$O(SRX(130.47,SRJ)) Q:'SRJ S SRJJ=$P($G(^SRF(SRTN,1,SRJ,0)),"^") D
134 .W !!,?5,"PROSTHESIS INSTALLED item: "_$P(^SRO(131.9,SRJJ,0),"^"),!,?6,"is missing at least one of the three required sterility fields."
135 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
136 I Y S SREDIT=1
137 Q
138CODE ; entry point from coding menu
139 N SRAGE,SRDIV,SRDIVNM,SRDO,SRFUNCT,SRHDR,SRINUSE,SRLEAVE,SRLOC,SRNOEDIT,SRPARAM,SRPRINT,SRSEL,SRSINED,SRDTITL,SRTIU,SRSTAT,SRXX
140 S SRNOEDIT=1,SRDTITL="Nurse Intraoperative Report"
141 S (SRFUNCT,SRLEAVE,SRSINED)=0,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2)
142 I SRTIU,$$STATUS^SROESUTL(SRTIU)=7 S SRSINED=1
143 D DISPLY,END
144 Q
145LIST 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)
146 S SRZ=0,SROO="" F S SROO=$O(SRY(130.47,SRTN,SROO)) Q:'SROO I SRY(130.47,SRTN,SROO,"I")="" D
147 .S SRX(130.47,$P(SROO,";"),$P(SROO,";",2))=""
148 Q
149TR S SRP=SRZ,SRP=$TR(SRP,"1234567890.","ABCDEFGHIJP")
150 Q
151PBJE ;;.205^TIME PAT IN OR
152PBCB ;;.232^TIME PAT OUT OR
153DD ;;44^SPONGE COUNT CORRECT (Y/N)
154DE ;;45^SHARPS COUNT CORRECT (Y/N)
155DF ;;46^INSTRUMENT COUNT CORRECT (Y/N)
156DG ;;47^SPONGE, SHARPS, & INST COUNTER
157DH ;;48^COUNT VERIFIER
158GA ;;71^TIME OUT VERIFIED
159GB ;;72^PREOPERATIVE IMAGING CONFIRMED
160GC ;;73^MARKED SITE CONFIRMED
161HB ;;82^TIME OUT VERIFY COMMENTS
162HC ;;83^IMAGING CONFIRMED COMMENTS
163HD ;;84^MARKED SITE COMMENTS
164EJF ;;506^HAIR REMOVAL METHOD
165EJH ;;508^HAIR REMOVAL COMMENTS
Note: See TracBrowser for help on using the repository browser.