Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGRPAUD

DGRPAUD.m

Go to the documentation of this file.
  1. DGRPAUD ;BP/MJB - REGISTRATION CATASTROPHIC EDITS ;Compiled May 21, 2008 14:52:59
  1. ;;5.3;PIMS;**1016**;JUN 30, 2012;Build 20
  1. ;This routine will be called by DGRPECE if a change is made to patient name, ssn, dob, and sex.
  1. ;It will will get patient information from the audit file for comparisons.
  1. ;DGIEN-Audit file IEN(S) for patient
  1. ;DGAUDZRO-zero node of the audit file
  1. ;DGDT-date in audit file
  1. ;DGFLDNMR=field number of change
  1. ;DGOPTION-option used to make the update
  1. ;DGCHG=check to verify if a change was made
  1. ;
  1. DGAUD(DFN,DGCNT) ;SET AUDITS FOR PATIENT
  1. N DGI,DGIEN,DGAUDIEN,DGAUDZRO,DGFLDNBR,DGOPTION,DGPTIEN,DGDT,DGCHG,DGTM,DGTODAY
  1. K ^TMP("DGRPAUD")
  1. S DGI=0,DGAUDZRO=0,U="^"
  1. S DGTODAY=$P($$NOW^XLFDT(),".")
  1. F S DGI=$O(^DIA(2,"B",DFN,DGI)) Q:'DGI D ;Get all audit IENS for patient.
  1. .S DGIEN(DGI)=DGI
  1. .S DGAUDZRO=$G(^DIA(2,DGIEN(DGI),0)) ;get zero node for all audits
  1. .I 'DGAUDZRO Q
  1. .S DGDT=$P(DGAUDZRO,"^",2),DGTM=$P(DGDT,".",1)
  1. .I DGTODAY'=DGTM Q ;only get todays audits
  1. .S DGFLDNBR=$P(DGAUDZRO,"^",3)
  1. .;get only NAME(.01),SEX(.02),DOB(.03),SSN(.09) for catastrophic edit checks
  1. .I DGFLDNBR'=".01"&(DGFLDNBR'=".02")&(DGFLDNBR'=".03")&(DGFLDNBR'=".09") Q
  1. .S DGOPTION=$P($G(^DIA(2,DGIEN(DGI),4.1)),U)
  1. .I 'DGOPTION Q
  1. .S DGCHG=$G(^DIA(2,DGIEN(DGI),2)) ;Check to see if change was made
  1. .I '$D(DGCHG)!(DGCHG="") Q
  1. .S DGPTIEN=$P(DGAUDZRO,U)
  1. .;set data into a temp global to be used by DGRPECE for changes
  1. .;this temp global will show changes that are currently in the audit file for this patient
  1. .;piece 1 - date and time of change
  1. .;piece 2 - changed field
  1. .;piece 3 - option used to change
  1. .;piece 4 - previous field value
  1. .;piece 5 - new field value
  1. .S ^TMP("DGRPAUD",$J,DFN,DGIEN(DGI))=$P(DGAUDZRO,U,2)_"^"_DGFLDNBR_"^"_DGOPTION_"^"_$G(^DIA(2,DGIEN(DGI),2))_"^"_$G(^DIA(2,DGIEN(DGI),3))_"^"_$P(DGAUDZRO,U,5)
  1. ;
  1. N DGAUDIEN
  1. S DGAUDIEN=0
  1. F S DGAUDIEN=$O(^TMP("DGRPAUD",$J,DFN,DGAUDIEN)) Q:'DGAUDIEN D
  1. .S DGCNT=DGCNT+1
  1. Q