source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRRLU2.m@ 1093

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1DGRRLU2 ;ALB/AAS - Patient Look-up log data, copied from DGSEC ;7/15/05 14:26
2 ;;5.3;Registration;**538**;Aug 13, 1993
3 ;
4NOTICE(RESULT,DFN,DGOPT,ACTION) ;RPC/API entry point for log entry and message generation
5 ;Input parameters:
6 ; DFN = Patient file DFN
7 ; DGOPT = Java application name, needed for DG Security Log file and bulletin
8 ; ACTION = 1 - Set DG Security Log entry, 2 - Generate mail
9 ; message, 3 - Both (Optional - Defaults to both)
10 ;
11 ;Output: RESULT = 1 - DG Security Log updated and/or Sensitive Record msg sent (Determined by ACTION value)
12 ; 0 - Required variable undefined
13 ;
14 I $G(DFN)="" S RESULT=0 Q
15 I $G(^DPT(+DFN,0))="" S RESULT=0 Q
16 I $G(DUZ)="" S RESULT=0 Q
17 S DGOPT=$G(DGOPT)
18 I $G(ACTION)="" S ACTION=3
19 I ACTION'=1 D BULTIN1(DFN,DUZ,.DGOPT)
20 I ACTION'=2 D SETLOG1(DFN,DUZ,,.DGOPT)
21 S RESULT=1 ;_"^"_$G(DGOPT)
22 Q
23 ;
24SETLOG1(DFN,DGDUZ,DG1,DGOPT) ;Adds/updates entry in DG Security Log file (38.1)
25 ;Input:
26 ; DFN - Patient (#2) file DFN (Required)
27 ; DGDUZ - New Person (#200) file IEN
28 ; DG1 - Inpatient or Outpatient (Optional)
29 ; DGOPT - Java Application name
30 ;
31 N DGA1,DGDATE,DGDTE,DGT,DGTIME,XQOPT
32 ;Lock global
33LOCK L +^DGSL(38.1,+DFN):1 G:'$T LOCK
34 ;Add new entry for patient if not found
35 I '$D(^DGSL(38.1,+DFN,0)) D
36 .S ^DGSL(38.1,+DFN,0)=+DFN
37 .S ^DGSL(38.1,"B",+DFN,+DFN)=""
38 .S $P(^DGSL(38.1,0),U,3)=+DFN
39 .S $P(^DGSL(38.1,0),U,4)=$P(^DGSL(38.1,0),U,4)+1
40 .;Determine if entry is automatically sensitive
41 .N ELIG,FLAG,X
42 .S FLAG=0
43 .S X=$S($D(^DPT(+DFN,"TYPE")):+^("TYPE"),1:"")
44 .I $D(^DG(391,+X,0)),$P(^(0),"^",4) S FLAG=1
45 .I 'FLAG S ELIG=0 F S ELIG=$O(^DPT(+DFN,"E",ELIG)) Q:'ELIG D Q:FLAG
46 ..S X=$G(^DIC(8,ELIG,0))
47 ..I $P(X,"^",12) S FLAG=1
48 .S $P(^DGSL(38.1,+DFN,0),"^",2)=FLAG
49 .;Date/time sensitivity was set
50 .S $P(^DGSL(38.1,+DFN,0),"^",4)=$$NOW^XLFDT()
51 ;determine if an inpatient
52 D H^DGUTL
53 S DGT=DGTIME
54 I $G(DG1)="" D ^DGPMSTAT
55 ;get option name
56 I $G(DGOPT)="" SET DGOPT="From Java Patient Lookup"
57 ;I $G(DGOPT)="" D OP^XQCHK S DGOPT=$S(+XQOPT<0:"^UNKNOWN",1:$P(XQOPT,U)_U_$P(XQOPT,U,2))
58SETUSR ;
59 S DGDTE=9999999.9999-DGTIME
60 I $D(^DGSL(38.1,+DFN,"D",DGDTE,0)) S DGTIME=DGTIME+.00001 G SETUSR
61 S:'$D(^DGSL(38.1,+DFN,"D",0)) ^(0)="^38.11DA^^"
62 S ^DGSL(38.1,+DFN,"D",DGDTE,0)=DGTIME_U_DGDUZ_U_DGOPT_U_$S(DG1:"y",1:"n")
63 S $P(^(0),U,3,4)=DGDTE_U_($P(^DGSL(38.1,+DFN,"D",0),U,4)+1)
64 S ^DGSL(38.1,"AD",DGDTE,+DFN)=""
65 S ^DGSL(38.1,"AU",+DFN,DGDUZ,DGDTE)=""
66 L -^DGSL(38.1,+DFN)
67 Q
68 ;
69BULTIN1(DFN,DGDUZ,DGOPT,DGMSG) ;Generate sensitive record access bulletin
70 ;
71 ;Input: DFN = Patient file IEN
72 ; DGDUZ = New Person (#200) file IEN
73 ; DGOPT = OPTION from Java
74 ; DGMSG = Message array (Optional)
75 ;
76 N DGEMPLEE,XMSUB,XQOPT
77 K DGB
78 ;I $D(^DG(43,1,"NOT")),+$P(^("NOT"),U,10) S DGB=10
79 ;Q:'$D(DGB)
80 S XMSUB="RESTRICTED PATIENT RECORD ACCESSED"
81 ;S DGB=+$P($G(^DG(43,1,"NOT")),U,DGB) Q:'DGB
82 ;S DGB=$P($G(^XMB(3.8,DGB,0)),U) Q:'$L(DGB)
83 S DGB=$$GET1^DIQ(43,1,509)
84 Q:'$L(DGB)
85 ;
86 I $G(DGOPT)="" SET DGOPT="From Java Patient Lookup"
87 N XMB,XMY,XMY0,XMZ
88 S XMB="DG SENSITIVITY",XMB(1)=$P(^DPT(+DFN,0),U)
89 S DGEMPLEE=$$EMPL^DGSEC4(+DFN)
90 I DGEMPLEE=1 S XMB(1)=XMB(1)_" (Employee)"
91 S XMB(2)=$P(^DPT(+DFN,0),U,9),XMB(3)=DGOPT,XMY("G."_DGB)=""
92 N Y S Y=$$NOW^XLFDT() X ^DD("DD") S XMB(4)=Y
93 D SEND(.XMB,.XMY)
94 S DGMSG(1)="NOTE: A bulletin will now be sent to your station security officer."
95 Q
96 ;
97SEND(XMB,XMY) ;Queue mail bulletin
98 ;Input: XMB,XMY=Mailman bulletin parameters
99 ;
100 N ZTSK,ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE,DGI,X,Y
101 F DGI="XMB","XMB(","XMY(" S ZTSAVE(DGI)=""
102 S ZTRTN="EN^XMB",ZTDESC="DG Security Bulletin",ZTIO="",ZTDTH=$H
103 D ^%ZTLOAD
104 Q
105TEST4 ;
106 N RESULT
107 SET RESULT=""
108 D NOTICE(.RESULT,40,"ALAN TEST",3)
109 W !,"Result = ",RESULT
110 Q
Note: See TracBrowser for help on using the repository browser.