source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIULP1.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: 4.2 KB
RevLine 
[613]1TIULP1 ; SLC/JER - More functions determining privilege ;1/19/95 17:49
2 ;;1.0;TEXT INTEGRATION UTILITIES;;Jun 20, 1997
3CANADDA(DA) ;Checks if an Addendum can be added
4 N TIUY,TIU0,TIU13,TIU15
5 I 'DA S TIUY="^There is no original report." G ADDAX
6 S TIU0=$G(^TIU(8925,+DA,0)),TIU13=$G(^(13)),TIU15=$G(^(15))
7 I +$P(TIU0,U,6) S TIUY="^This is an addendum." G ADDAX
8 ; If release is required, and document isn't released
9 ; I ------ S TIUY="^Document isn't released from transcription.") G ADDAX
10 ; I ------ S TIUY="^Original Discharge Summary isn't verified." G ADDAX
11 I +$G(DUZ)=$P(ACT,U,9) D G:$D(TIUX) ADDAX
12 . I '$P(ACT,U,11) S TIUX="^Discharge Summary isn't cosigned."
13 I +$G(DUZ)=$P(ACT,U) D G:$D(TIUX) ADDAX
14 . I '$P(ACT,U,4) S TIUX="^Discharge Summary isn't signed nor cosigned."
15 S TIUX=1
16ADDAX ;Exit for CANADDA
17 I $P($G(TIUX),U,2)]"" S TIUX=TIUX_" Can't enter Addendum."
18 Q TIUX
19CANEDITA(TIUDA,TIUY) ;Checks if an Addendum can be edited
20 N ACT,TIUX,DA,TIUCNT,SIGN,COSIGN,TIUCHIEF
21 S TIUCNT=0
22 I '$D(^TIU(8925,"DAD",+TIUDA))!(+$P($G(^TIU(8925,+TIUDA,0)),U,6)) G EDITAX
23 S DA=0 F S DA=$O(^TIU(8925,"DAD",+TIUDA,DA)) Q:+DA'>0 D
24 . S ACT=$G(^TIU(8925,+DA,"ACT")),SIGN=$P(ACT,U,4),COSIGN=$P(ACT,U,11)
25 . S TIUCHIEF=+$D(^XUSEC("TIU SERVICE CHIEF",+$G(DUZ)))
26 . I ACT']"" Q
27 . I $D(TIUXCRP) D Q
28 . . ;Transcriptionist and requires release
29 . . I $P($G(TIUPRM1),U,3),'$P(ACT,U,19) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA
30 . . ;Transcriptionist, doesn't require release, requires verification
31 . . I '$P($G(TIUPRM1),U,3),$P($G(TIUPRM1),U,2),'$P(ACT,U,8) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA
32 . ;MRT or MIS Manager and requires MAS verification
33 . I $P(TIUPRM1,U,2),$D(TIUMRT)!($D(^XUSEC("TIU MANAGER",+$G(DUZ)))) D Q
34 . . I $P(ACT,U,19),'SIGN,'COSIGN S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA
35 . . I '$P(ACT,U,19),$P(ACT,U,5)=+$G(DUZ) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA
36 . ;If not transcriptionist nor MIS, transcriber can see it till signed
37 . I '$D(TIUXCRP),'$D(TIUMRT),'$D(^XUSEC("TIU MANAGER",+$G(DUZ))),$P(ACT,U,5)=+$G(DUZ) D Q
38 . . I 'SIGN,'COSIGN S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA Q
39 . ;Check if author or cosigner and unreleased or unverified or signed
40 . I $P(ACT,U)=+$G(DUZ)!($P(ACT,U,9)=+$G(DUZ))!(TIUCHIEF)!($D(^XUSEC("TIU SURROGATE",+$G(DUZ)))) D Q
41 . . I +$P(TIUPRM1,U,3),'+$P(ACT,U,19) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)="^ exists but is not yet released from transcription." Q
42 . . I +$P(TIUPRM1,U,2),'+$P(ACT,U,8) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)="^ exists but is not yet verified." Q
43 . . I COSIGN S TIUCNT=TIUCNT+1,TIUY(TIUCNT)="^ exists but has been cosigned" Q
44 . . I 'SIGN,'COSIGN S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA Q
45 . . I SIGN,'COSIGN,$P(ACT,U,9)=+$G(DUZ)!(TIUCHIEF) S TIUCNT=TIUCNT+1,TIUY(TIUCNT)=DA Q
46EDITAX ;Exit for CANEDITA
47 S TIUX=$S($D(TIUY(TIUCNT)):1,1:0)
48 Q TIUX
49READYSIG(DA) ;Check if user is provider & rec is ready for signature
50 N ACT,TIUY
51 S TIUY=0,ACT=$G(^TIU(8925,+DA,"ACT"))
52 I $D(^XUSEC("PROVIDER",+$G(DUZ)))!($D(^XUSEC("TIU AUTHOR",+$G(DUZ))))!($D(^XUSEC("TIU SURROGATE",+$G(DUZ)))) D
53 . I $P(TIUPRM1,U,2) D Q ;Verification required and completed
54 . . I +$P(ACT,U,8) S TIUY=1
55 . I $P(TIUPRM1,U,3) D Q ;Verification not required,
56 . . ;transcription release required and released
57 . . I +$P(ACT,U,19) S TIUY=1
58 . ; Verification and transcription release not required
59 . S TIUY=1
60READYX ;Exit for READYSIG
61 Q TIUY
62CANDEL(DA) ; Check whether user has authority to delete record
63 N Y
64 I $D(^XUSEC("TIU MANAGER",DUZ)) S Y=1 G CANDELX
65 S Y="0^You are not authorized to DELETE Discharge Summaries."
66CANDELX Q Y
67CANSEND(TIUDA) ; Checks of user can send DCS back to transcription
68 N ACT,TIUY
69 S ACT=$G(^TIU(8925,+TIUDA,"ACT")) D
70 . I +$P(ACT,U,16) S TIUY="^ Has been purged." Q
71 . I +$P(TIUPRM1,U,3),'+$P(ACT,U,19) S TIUY="0^ Is already available to transcription." Q
72 . I +$P($G(^TIU(8925,+DA,"ACT")),U,11) S TIUY="0^ Attending Physician has signed." Q
73 . S TIUY=+$$READ^TIUU("YO","Are you sure you want to send report back to "_$S($P(ACT,U)=$P(ACT,U,5):"author",1:"transcription"),"NO","^D SBACK^TIUDIRH")
74 Q TIUY
75CANAMND(TIUDA) ; Checks whether user can amend a discharge summary
76 N ACT,TIUY
77 S ACT=$G(^TIU(8925,+TIUDA,"ACT"))
78 I +$P(ACT,U,4)'>0 S TIUY="0^ Not yet signed"
79 I +$P(ACT,U,11)'>0 S TIUY="0^ Not yet cosigned" G CANAMNX
80 S TIUY=1
81CANAMNX Q TIUY
Note: See TracBrowser for help on using the repository browser.