source: WorldVistAEHR/trunk/r/SURGERY-SR/SROESXP.m@ 862

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1SROESXP ;BIR/ADM - SURGERY E-SIG UTILITY ; [ 06/16/04 09:30 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 ;
12 Q
13SCOND(X1,X2) ; set condition for AESP x-ref
14 N SRADD,SRI,X1NULL,X2NULL S (X1NULL,X2NULL)=0
15 F SRI=1,2 S:X1(SRI)="" X1NULL=1 S:X2(SRI)="" X2NULL=1
16 I X1NULL&'X2NULL S SRADD=1
17 E S SRADD=0
18 I SRADD,'X(2) S SRADD=0
19 I X1(1)=X2(1),'X1(2),X2(2) S SRADD=1
20 Q SRADD
21KCOND(X1,X2) ; kill condition for AESP x-ref
22 N SRDEL,SRI,X1NULL,X2NULL S (X1NULL,X2NULL)=0
23 F SRI=1,2 S:X1(SRI)="" X1NULL=1 S:X2(SRI)="" X2NULL=1
24 I X2NULL&'X1NULL S SRDEL=1
25 E S SRDEL=0
26 I SRDEL,'X(2) S SRDEL=0
27 I X1(1)=X2(1),'X2(2),X1(2) S SRDEL=1
28 Q SRDEL
29AESP ; set logic for AESP cross-reference
30 N SRTN,ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSAVE,ZTSK
31 S SRTN=DA I '$P($G(^SRF(SRTN,"NON")),"^",5)!'$P($G(^SRF(SRTN,"TIU")),"^",5) Q
32 S ZTDESC="Surgery Non-OR Procedure Report Stub",ZTRTN="PR^SROESXP",ZTIO="",ZTDTH=$H,ZTSAVE("SRTN")="" D ^%ZTLOAD
33 Q
34PR ; create stub entry in TIU for non-OR procedure report
35 N DFN,DIC,SR0,SRACODE,SRATT,SRAY,SRD,SRDIV,SRDOC,SRLOC,SRPROV,SRTIU,SRV,SRX,TITLE,VDT,VLOC,VSIT,VSTR,X,Y
36 I '$P($G(^SRF(SRTN,"NON")),"^",5)!'$P($G(^SRF(SRTN,"TIU")),"^",5) D END Q
37 S SRD=$P($G(^SRF(SRTN,"TIU")),"^",3) I SRD D END Q
38 S SRX=$$WHATITLE^TIUPUTU("PROCEDURE REPORT"),TITLE=$P(SRX,"^") I 'TITLE Q
39 S SRDIV=$$SITE^SROUTL0(SRTN),SR0=^SRF(SRTN,0),DFN=$P(SR0,"^") D LOC
40 S X=$G(^SRF(SRTN,"NON")),SRATT=$P(X,"^",7),SRPROV=$P(X,"^",6)
41 S SRACODE=$P($G(^SRF(SRTN,.1)),"^",10)
42 I 'SRATT D
43 .I "159"[SRACODE S SRATT=SRPROV Q
44 .I SRDIV,'$P(^SRO(133,SRDIV,0),"^",19) S SRATT=SRPROV
45 S SRAY(.02)=DFN,SRAY(.05)=1,(SRAY(1202),SRAY(1204))=SRPROV,SRAY(1205)=SRLOC,(SRAY(1208),SRAY(1209))=SRATT,SRAY(1301)=$P(SR0,"^",9),SRAY(1405)=SRTN_";SRF(",SRAY(1701)="Case #: "_SRTN
46 S (VDT,VLOC,VSIT)=""
47 S (SRAY(1301),VDT)=$P($G(^SRF(SRTN,"NON")),"^",4),VSIT=$P(SR0,"^",15)
48 I 'VSIT S VLOC=SRLOC
49 I VLOC S SRAY(1211)=VLOC,VSTR=VLOC_";"_VDT_";"_$S(+$D(^DPT(DFN,.1)):"I",1:"E")
50 D MAKE^TIUSRVP(.SRTIU,DFN,TITLE,VDT,VLOC,VSIT,.SRAY,$G(VSTR),1,1) I SRTIU D
51 .F L +^SRF("TIU"_SRTN):5 I $T S $P(^SRF(SRTN,"TIU"),"^",3)=SRTIU L -^SRF("TIU"_SRTN) Q
52END S ZTREQ="@"
53 Q
54LOC ; get patient location
55 N SRDEF,SROR,SRT,SRWARD,VAIP S VAIP("D")=$P($G(^SRF(SRTN,"NON")),"^",4) D IN5^VADPT
56 S SRWARD=$P(VAIP(5),"^"),(SRDEF,SRLOC)="",SROR=$P($G(^SRF(SRTN,"NON")),"^",2)
57 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"))
58 S SRDEF=$P($G(^SRO(133,SRDIV,0)),"^",23)
59 I SRDEF="" S X="SURGERY OP REPORT NON-COUNT",DIC(0)="M",DIC="^SC(" D ^DIC K DIC I +Y>0 S SRDEF=+Y
60 S SRLOC=$S(SRLOC:SRLOC,SRDEF:SRDEF,SROR:SROR,1:"")
61 Q
62STATUS(SRSTAT) ; update status
63 K SRAY S SRAY(.05)=SRSTAT D UPDATE^TIUSRVP(.SRDOC,SRTIU,.SRAY,1)
64 Q
65KAESP ; kill logic for the AESP cross-reference
66 N SRTN,ZTDESC,ZTRTN,ZTIO,ZTDTH,ZTSAVE,ZTSK S SRTN=DA
67 S ZTDESC="Surgery Non-OR Procedure Report Delete Stub",ZTRTN="KSTUB^SROESXP",ZTIO="",ZTDTH=$H,ZTSAVE("SRTN")="" D ^%ZTLOAD
68 Q
69KSTUB ; delete stub in TIU for unsigned procedure report (non-OR)
70 N SRERR,SRTIU
71 S SRTIU=$P($G(^SRF(SRTN,"TIU")),"^",3) I SRTIU D DELETE^TIUSRVP(.SRERR,SRTIU,,1) I 'SRERR D
72 .F L +^SRF("TIU"_SRTN):5 I $T S $P(^SRF(SRTN,"TIU"),"^",3)="" L -^SRF("TIU"_SRTN) Q
73 D END
74 Q
Note: See TracBrowser for help on using the repository browser.