VistA-FOIAVistA/r/REGISTRATION-DGQE-DG-DPT-GR.../DGISORPT.m

58 lines
2.4 KiB
Mathematica

DGISORPT ;ALB/WJG/DHH SENSITIVE RECDS RPT;06/18/2005
;;5.3;Registration;**666**;Aug 13, 1993
;This was based off of a Pug Fileman template, that was tasked
;to run by the user. It was changed to incorporate the use of a
;Mail Group.
;
EN ;
K ^TMP($J),^UTILITY($J)
S U="^"
S (DGYEST,A)=9999999.9999-$$FMADD^XLFDT(DT,-1),A=A-1
F S A=$O(^DGSL(38.1,"AD",A)),A1=0 Q:'A!(A>DGYEST) F S A1=$O(^DGSL(38.1,"AD",A,A1)) Q:A1="" D
. S RECDAT=$G(^DGSL(38.1,A1,0)) Q:RECDAT=""
. S RECDAT1=$G(^DGSL(38.1,A1,"D",A,0)) Q:RECDAT1=""
. S RDATE=$P(RECDAT1,U) Q:RDATE=""
. S RDATE1=$E(RDATE,4,5)_"/"_$E(RDATE,6,7)_"/"_$E(RDATE,2,3)
. S TIME=$P(RDATE,".",2),TIME=$E(TIME_"0000",1,4)
. S RDATE1=RDATE1_"@"_TIME
. S PATNAME=$P($G(^DPT(A1,0)),U) Q:PATNAME=""
. S USERIEN=$P(RECDAT1,U,2) Q:USERIEN=""
. S OPT=$P(RECDAT1,U,3) S:OPT="" OPT=""
. S INP=$P(RECDAT1,U,4) S:INP="" INP=""
. S USERDAT=$G(^VA(200,USERIEN,0)) Q:USERDAT=""
. S USER=$E($P(USERDAT,U),1,20) Q:USER=""
. S TITLE1=$P(USERDAT,U,9) S:TITLE1="" TITLE=""
. S:TITLE1'="" TITLE=$P($G(^DIC(3.1,TITLE1,0)),U)
. S ALIAS=$P($G(^VA(200,USERIEN,3,1,0)),U)
. S SECIEN=$P($G(^VA(200,USERIEN,5)),U) S:SECIEN="" SECT=""
. S:SECIEN'="" SECT=$P($G(^DIC(49,SECIEN,0)),U) S:SECT="" SECT=""
. S:USERIEN=".5" SECT="VISTA SYSTEM"
. S:SECT'="" SECT=$E(SECT,1,20) S:ALIAS'="" ALIAS=$E(ALIAS,1,5) S:OPT'="" OPT=$E(OPT,1,25)
. S ^UTILITY($J,RDATE,A1)=PATNAME_U_RDATE1_U_USER_U_TITLE_U_ALIAS_U_SECT_U_OPT_U_INP
XMTEXT ;sets up message text
S LINE=0
S LINE=LINE+1
S ^TMP($J,LINE)="PATIENT^DATE/TIME^USER^TITLE^ALIAS^SERVICE^OPTION USED^INPATIENT"
S LINE=LINE+1
S T1=0 F S T1=$O(^UTILITY($J,T1)) Q:T1="" S T2=0 F S T2=$O(^UTILITY($J,T1,T2)) Q:T2="" D
. S TEXT=$G(^UTILITY($J,T1,T2)) Q:TEXT=""
. S ^TMP($J,LINE)=TEXT,LINE=LINE+1
NOPAT ;set message text if ^tmp($J=null
I '$D(^TMP($J,2)) D
. S ^TMP($J,2)="No Sensitive Records were accessed on "_$$FMTE^XLFDT(DT-1,1)_"."
SEND ;
S XMSUB="Sensitive Record Auditing Report"
S XMTEXT="^TMP($J,"
S XMY("G.DG ISO SENSITIVE RCDS")=""
S XMDUZ=.5 D ^XMD
K XMDUZ,XMSUB,XMTEXT,XMY,^TMP($J)
Q ;
K XMSUB,XMTEXT,XMY,XMDUZ,LINE,T1,T2,TEXT,^UTILITY($J),^TMP($J),X1,X2,RDATE,A,A1,PATNAME,RECDAT,RECDAT1,USER
K TITLE,TITLE1,OPT,INP,USERDAT,SECT,ALIAS,USERIEN,X,Y,SECIEN,TIME,RDATE1,DGYEST
Q
HEADER ;Header for export option
S DGCNT=$G(DGCNT)+1
I DGCNT=1 W !,"PATIENT^DATE/TIME^USER^TITLE^ALIAS^SERVICE^OPTION USED^INPATIENT",!
; DGCNT is killed upon exiting DG SENSITIVE RCDS RPT-EXPORT option
Q