source: WorldVistAEHR/trunk/r/SURGERY-SR/SROESTV.m@ 1154

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1SROESTV ;BIR/ADM - SURGERY E-SIG UTILITY ; [ 03/02/04 8:03 AM ]
2 ;;3.0; Surgery ;**100**;24 Jun 93
3 ;
4 ;** NOTICE: This routine is part of an implementation of a nationally
5 ;** controlled procedure. Local modifications to this routine
6 ;** are prohibited.
7 ;
8 ; Reference to GETDOCS^TIUSRVLR supported by DBIA #3536
9 ;
10 Q
11LIST(SRG,SRDFN,SRSDT,SREDT,SRMAX,SRLDOC) ; return list of completed cases between start and end dates in reverse chronological order
12 ;
13 ; SRG - return array
14 ; SRDFN - pointer to patient file (DFN)
15 ; SRSDT - (optional) start date (earlier date)
16 ; SREDT - (optional) end date (later date)
17 ; SRMAX - (optional) maximum number of case to return
18 ; SRLDOC - (optional) flag to list documents (1) or not (0) (default is 1, list documents)
19 ;
20 N SRCNT,SRDATE,SREXT,SRFLG,SROP,SRPROV,SRSTOP,SRSDATE,SRQ
21 S:'$L($G(SRG)) SRG="^TMP(""SRLIST"",$J)" K @SRG
22 S:'$L($G(SRSDT)) SRSDT=0 S:'$L($G(SREDT)) SREDT=DT S:'$L($G(SRMAX)) SRMAX=""
23 S (SRCNT,SRQ)=0,X=SREDT+.9999,SRDATE=9999999.9999-X,X=SRSDT-.0001,SRSTOP=9999999.9999-X
24 S:$G(SRLDOC)'=0 SRLDOC=1
25 F S SRDATE=$O(^SRF("ADT",SRDFN,SRDATE)) Q:'SRDATE!(SRDATE'<SRSTOP)!SRQ D
26 .S SROP=0 F S SROP=$O(^SRF("ADT",SRDFN,SRDATE,SROP)) Q:'SROP!SRQ D
27 ..I SRMAX,SRCNT'<SRMAX S SRQ=1 Q
28 ..S SRFLG=1 D CASE
29 Q
30ONE(SRG,SROP) ; return documents associated with a single case
31 ;
32 ; SRG - return array
33 ; SROP - case number in file 130
34 ;
35 N SRCNT,SRMAX,SRFLG
36 S:'$L($G(SRG)) SRG="SRTIU" K @SRG
37 S SRCNT=SROP,SRMAX="",SRFLG=0
38 D CASE,DOCS
39 Q
40CASE ; list case info
41 N SRDOC,SRNON,SRSOUT,SROPER,SRN2
42 S (SRNON,SRSOUT)=0,SRN2=$G(^SRF(SROP,.2))
43 I $P($G(^SRF(SROP,"NON")),"^")="Y" S SRNON=1
44 I SRNON,$P($G(^SRF(SROP,"NON")),"^",5)="" Q
45 I 'SRNON,'$P(SRN2,"^",12)!$P($G(^SRF(SROP,37)),"^")&'($P(SRN2,"^",4)&$P($G(^SRF(SROP,"TIU")),"^",4)) Q
46 S SROPER=$P(^SRF(SROP,"OP"),"^") I SRNON S SROPER=SROPER_" (Non-OR)"
47 I $P($G(^SRF(SROP,30)),"^") S SROPER="* Aborted * "_SROPER
48 S X=$G(^SRF(SROP,"TIU")),SRDOC="" F I=1:1:4 S SRDOC(I)=$P(X,"^",I) I SRDOC(I) S SRDOC="+"
49 S SRSDATE=$P($G(^SRF(SROP,0)),"^",9)
50 I SRNON S SRPROV=$P(^SRF(SROP,"NON"),"^",6),SREXT=$$EXTERNAL^DILFD(130,123,"",SRPROV)
51 I 'SRNON S SRPROV=$P($G(^SRF(SROP,.1)),"^",4),SREXT=$$EXTERNAL^DILFD(130,.14,"",SRPROV)
52 S SRPROV=SRPROV_";"_SREXT S:SRFLG SRCNT=SRCNT+1
53 S @SRG@(SRCNT)=SROP_"^"_SROPER_"^"_SRSDATE_"^"_SRPROV_"^"_SRDOC
54 I SRFLG,SRLDOC D DOCS
55 Q
56DOCS ; fetch documents associated with surgical case
57 N SRLB,SRNUM,SRNUMX,SRTITLE,SRTIUY,SROVP K ^TMP("SRTMP",$J)
58 S SRTIUY="",SROVP=SROP_";SRF(" D GETDOCS^TIUSRVLR(SRTIUY,SROVP)
59 S SRNUM=0 F S SRNUM=$O(^TMP("TIULIST",$J,SRNUM)) Q:'SRNUM D
60 .S SRTITLE=$P(^TMP("TIULIST",$J,SRNUM),"^",2)
61 .I SRTITLE["OPERATION REPORT"!(SRTITLE["PROCEDURE REPORT") S ^TMP("SRTMP",$J,1,SRNUM)=^TMP("TIULIST",$J,SRNUM) Q
62 .I SRTITLE["NURSE INTRAOPERATIVE REPORT" S ^TMP("SRTMP",$J,2,SRNUM)=^TMP("TIULIST",$J,SRNUM) Q
63 .I SRTITLE["ANESTHESIA REPORT" S ^TMP("SRTMP",$J,3,SRNUM)=^TMP("TIULIST",$J,SRNUM)
64 S SRNUMX=1 F SRLB=1,2,3 S SRNUM=0 F S SRNUM=$O(^TMP("SRTMP",$J,SRLB,SRNUM)) Q:'SRNUM S @SRG@(SRCNT,SRNUMX)=^TMP("SRTMP",$J,SRLB,SRNUM),SRNUMX=SRNUMX+1
65 K ^TMP("SRTMP",$J)
66 Q
67NON(SROP) ; determine if case is non-OR procedure
68 ; returns 1 if case is non-OR procedure
69 ; returns 0 if case is not non-OR procedure
70 N SRNON S SRNON=0 I $P($G(^SRF(SROP,"NON")),"^")="Y" S SRNON=1
71 Q SRNON
72OPTOP(SROP) ; return parameter value for showing OpTop on signature
73 ; 0 - never display Op Top
74 N SROPTOP S SROPTOP=0
75 Q SROPTOP
Note: See TracBrowser for help on using the repository browser.