source: FOIAVistA/tag/r/SURGERY-SR/SROESX.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

File size: 5.4 KB
Line 
1SROESX ;BIR/ADM - SURGERY E-SIG UTILITY ; [ 06/16/04 09:21 AM ]
2 ;;3.0; Surgery ;**100,129**;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 $$WHATITLE^TIUPUTU supported by DBIA #3351
8 ; Reference to DELETE^TIUSRVP supported by DBIA #3535
9 ; Reference to MAKE^TIUSRVP supported by DBIA #3535
10 ; Reference to UPDATE^TIUSRVP supported by DBIA #3535
11 ; Reference to $$CANDEL^TIUSRVP1 supported by DBIA #4175
12 ;
13 Q
14AES ; set logic for AES cross-reference
15 N SRTN,ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSAVE,ZTSK
16 S SRTN=DA I $P($G(^SRF(SRTN,"NON")),"^")="Y" Q
17 S ZTDESC="Surgery Nurse Intraop Report Stub",ZTRTN="NR^SROESX",ZTIO="",ZTDTH=$H,ZTSAVE("SRTN")="" D ^%ZTLOAD
18 S ZTDESC="Surgery Operation Report Stub",ZTRTN="OR^SROESX",ZTIO="",ZTDTH=$H,ZTSAVE("SRTN")="" D ^%ZTLOAD
19 Q
20NR ; create stub entry in TIU for nurse intraop report
21 N DFN,DIC,SR0,SRAY,SRCIRC,SRD,SRDOC,SRLOC,SRRN,SRTIU,SRV,SRX,TITLE,VDT,VLOC,VSIT,VSTR,X,Y
22 I '$P($G(^SRF(SRTN,.2)),"^",12) D END Q
23 S SRD=$P($G(^SRF(SRTN,"TIU")),"^",2) I SRD D END Q
24 S SRX=$$WHATITLE^TIUPUTU("NURSE INTRAOPERATIVE REPORT"),TITLE=$P(SRX,"^") I 'TITLE Q
25 S SRDIV=$$SITE^SROUTL0(SRTN),SR0=^SRF(SRTN,0),DFN=$P(SR0,"^") D LOC
26 S SRAY(.02)=DFN,SRAY(.05)=1,SRAY(1205)=SRLOC,SRAY(1301)=$P(SR0,"^",9),SRAY(1405)=SRTN_";SRF(",SRAY(1701)="Case #: "_SRTN
27 S X=$G(^SRF(SRTN,.2)),SRAY(.07)=$P(X,"^",10),SRAY(.08)=$P(X,"^",12)
28 S VDT=$P(SR0,"^",9),VSIT=$P(SR0,"^",15),VLOC=""
29 I 'VSIT S VLOC=SRLOC
30 I VLOC S SRAY(1211)=VLOC,VSTR=VLOC_";"_VDT_";"_$S(+$D(^DPT(DFN,.1)):"I",1:"E")
31 S SRCIRC="",SRRN=$O(^SRF(SRTN,19,0)) S:SRRN SRCIRC=$P($G(^SRF(SRTN,19,SRRN,0)),"^") S (SRAY(1202),SRAY(1204))=SRCIRC
32 D MAKE^TIUSRVP(.SRTIU,DFN,TITLE,VDT,VLOC,VSIT,.SRAY,$G(VSTR),1,1) I SRTIU D
33 .F L +^SRF("TIU"_SRTN):5 I $T S $P(^SRF(SRTN,"TIU"),"^",2)=SRTIU L -^SRF("TIU"_SRTN) Q
34 .D ALERT
35END I $D(ZTQUEUED) S ZTREQ="@"
36 Q
37LOC ; get patient location
38 N SRDEF,SROR,SRT,SRWARD,VAIP,X,Y
39 S VAIP("D")=$P(SR0,"^",9) D IN5^VADPT
40 S (SRDEF,SRLOC)="",SRWARD=$P(VAIP(5),"^"),SROR=$P(SR0,"^",2) I SROR S SROR=$P(^SRS(SROR,0),"^")
41 I SRWARD K DA,DIC,DIQ,DR S DA=SRWARD,DIC=42,DR="44",DIQ="SRT",DIQ(0)="I" D EN^DIQ1 K DA,DIC,DIQ,DR S SRLOC=$G(SRT(42,SRWARD,44,"I"))
42 S SRDEF=$P($G(^SRO(133,SRDIV,0)),"^",23)
43 I SRDEF="" S X="SURGERY OP REPORT NON-COUNT",DIC(0)="M",DIC="^SC(" D ^DIC K DIC I +Y>0 S SRDEF=+Y
44 S SRLOC=$S(SRLOC:SRLOC,SRDEF:SRDEF,SROR:SROR,1:"")
45 Q
46ALERT ; issue alert to circulating nurse(s)
47 S XQAID="SRNIR-"_SRTN,XQAKILL=0 D DELETEA^XQALERT K XQAID,XQAKILL
48 N DFN,SRNM,SRRN,SRX S SRRN=0 F S SRRN=$O(^SRF(SRTN,19,SRRN)) Q:'SRRN S SRX=$P($G(^SRF(SRTN,19,SRRN,0)),"^") I SRX S XQA(SRX)=""
49 I '$D(XQA) S XQA(DUZ)=""
50 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SRNM=$E($P(VADM(1),"^"),1,15)_" ("_$E($P(VADM(1),"^"))_VA("BID")_"): "
51 S SRLAB=SRNM_$E($P(^SRF(SRTN,"OP"),"^"),1,25)_" (NIR ready to complete)"
52 S XQAMSG=SRLAB,XQAROU="ACTION^SROESX",XQAID="SRNIR-"_SRTN,XQADATA=SRTN D SETUP^XQALERT
53 Q
54STATUS(SRSTAT) ; update status
55 K SRAY S SRAY(.05)=SRSTAT D UPDATE^TIUSRVP(.SRDOC,SRTIU,.SRAY,1)
56 Q
57OR ; create stub entry in TIU for Operation Report
58 N DFN,DIC,SR0,SRACODE,SRATT,SRAY,SRD,SRDIV,SRDOC,SRLOC,SRSURG,SRTIU,SRV,SRX,TITLE,VDT,VLOC,VSIT,VSTR,X,Y
59 I '$P($G(^SRF(SRTN,.2)),"^",12) D END Q
60 S SRD=$P($G(^SRF(SRTN,"TIU")),"^") I SRD D END Q
61 S SRX=$$WHATITLE^TIUPUTU("OPERATION REPORT"),TITLE=$P(SRX,"^") I 'TITLE Q
62 S SRDIV=$$SITE^SROUTL0(SRTN),SR0=^SRF(SRTN,0),DFN=$P(SR0,"^") D LOC
63 S X=$G(^SRF(SRTN,.1)),SRATT=$P(X,"^",13),SRSURG=$P(X,"^",4),SRACODE=$P(X,"^",10)
64 I 'SRATT D
65 .I "159"[SRACODE S SRATT=SRSURG Q
66 .I SRDIV,'$P(^SRO(133,SRDIV,0),"^",19) S SRATT=SRSURG
67 S SRAY(.02)=DFN,SRAY(.05)=1,(SRAY(1202),SRAY(1204))=SRSURG,SRAY(1205)=SRLOC,(SRAY(1208),SRAY(1209))=SRATT,SRAY(1301)=$P(SR0,"^",9),SRAY(1405)=SRTN_";SRF(",SRAY(1701)="Case #: "_SRTN
68 S X=$G(^SRF(SRTN,.2)),SRAY(.07)=$P(X,"^",10),SRAY(.08)=$P(X,"^",12)
69 S VDT=$P(SR0,"^",9),VSIT=$P(SR0,"^",15),VLOC=""
70 I 'VSIT S VLOC=SRLOC
71 I VLOC S SRAY(1211)=VLOC,VSTR=VLOC_";"_VDT_";"_$S(+$D(^DPT(DFN,.1)):"I",1:"E")
72 D MAKE^TIUSRVP(.SRTIU,DFN,TITLE,VDT,VLOC,VSIT,.SRAY,$G(VSTR),1,1) I SRTIU D
73 .F L +^SRF("TIU"_SRTN):5 I $T S $P(^SRF(SRTN,"TIU"),"^")=SRTIU L -^SRF("TIU"_SRTN) Q
74 D END
75 Q
76KAES ; kill logic for the AES cross-reference
77 N SRTN,ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSAVE,ZTSK S SRTN=DA
78 F SRI=1,2 S ZTDESC="Surgery "_$S(SRI=2:"Nurse Intraop",1:"Op")_" Report Delete Stub",ZTRTN="KSTUB^SROESX",ZTIO="",ZTDTH=$H,(ZTSAVE("SRTN"),ZTSAVE("SRI"))="" D ^%ZTLOAD
79 Q
80KSTUB ; delete stubs in TIU for unsigned nurse intraop & op reports
81 N SRERR,SRODA,SRTIU
82 S SRODA=SRTN,SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",SRI) I SRTIU D
83 .D STATUS(5)
84 .D DELETE^TIUSRVP(.SRERR,SRTIU,,1) I 'SRERR D
85 ..F L +^SRF("TIU"_SRTN):5 I $T S $P(^SRF(SRTN,"TIU"),"^",SRI)="" L -^SRF("TIU"_SRTN) Q
86 D DELRT,END
87 Q
88ACTION ; alert action
89 N SRALRT,SRTN K XQAKILL S SRTN=XQADATA,SRALRT=1 D ^SRONIN
90 S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",2) I SRTIU,$$STATUS^SROESUTL(SRTIU)=7 D DELRT
91 Q
92DELRT N XQAID,XQAKILL S XQAID="SRNIR-"_SRTN,XQAKILL=0 D DELETEA^XQALERT
93 Q
94DEL(SRTN,SP) ; check document status to determine if OK to delete/edit field
95 ; SRTN - surgery case ien
96 ; SP - piece number in ^SRF(SRTN,"TIU"), comma delimited if multiple pieces
97 ;
98 N FLG,II,SRTIU,PCE S FLG=0
99 S SRTIU=$G(^SRF(SRTN,"TIU")) F II=1:1:$L(SP,",") S PCE=$P(SP,",",II) I $P(SRTIU,"^",PCE) I $$CANDEL^TIUSRVP1($P(SRTIU,"^",PCE))=0 S FLG=1
100 Q FLG
Note: See TracBrowser for help on using the repository browser.