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

LRBLAUD.m

Go to the documentation of this file.
  1. LRBLAUD ; IHS/DIR/AAB - AUDIT TRAIL MULTIPLE FIELDS 9/3/97 14:32 ; [ 9/3/97 9:28 AM ]
  1. ;;5.2;LR;**1003**;JUN 01, 1998
  1. ;;5.2;LAB SERVICE;**90**;Sep 27, 1994
  1. ;
  1. ;
  1. ; Routine is called by file 65 edit template LRBLIXR
  1. ;
  1. ; Multiple field arrays are built and totaled before and after
  1. ; editing LRBLIXR to be used for comparison. If total after editing
  1. ; is less than before editing, then the entire node is put onto
  1. ; the Audit trail for Blood Bank.
  1. ;
  1. REL ; Gets original relocation episodes for a unit, sets into the
  1. ; BEGR() array and counts total for later comparison
  1. S (REL,BEGREL)=0
  1. F S REL=$O(^LRD(65,LRIEN,3,REL)) Q:REL'>0 S BEGREL=BEGREL+1,BEGR(REL)=^LRD(65,LRIEN,3,REL,0)
  1. Q
  1. ;
  1. REL1 ; Gets relocation episodes for unit after editing, sets into AFTR()
  1. ; array, counts total. If total after edit < original total, then
  1. ; entire deleted record is built onto the audit trail
  1. S (REL,AFTREL)=0
  1. F S REL=$O(^LRD(65,LRIEN,3,REL)) Q:REL'>0 S AFTREL=AFTREL+1,AFTR(REL)=^LRD(65,LRIEN,3,REL,0)
  1. I AFTREL<BEGREL D
  1. . S LRM=NODE
  1. . S O=$P(LRM,U),Z="65.03,.01" D AUDIT
  1. . S O=$P(LRM,U,2),Z="65.03,.02" D AUDIT
  1. . S O=$P(LRM,U,3),Z="65.03,.03" D AUDIT
  1. . S O=$P(LRM,U,4),Z="65.03,.04" D AUDIT
  1. . S O=$P(LRM,U,5),Z="65.03,.05" D AUDIT
  1. . S O=$P(LRM,U,6),Z="65.03,.06" D AUDIT
  1. . S O=$P(LRM,U,7),Z="65.03,.07" D AUDIT
  1. . K NODE
  1. Q
  1. ;
  1. PAT ; Gets all unit's Patient Xmatched/Assigned episodes, sets into
  1. ; the BEGP() array & counts total for later comparison
  1. S (BEGPAT,PAT)=0
  1. F S PAT=$O(^LRD(65,LRIEN,2,PAT)) Q:PAT'>0 S BEGPAT=BEGPAT+1,BEGP(PAT)=^LRD(65,LRIEN,2,PAT,0)
  1. Q
  1. ;
  1. PAT1 ; Gets all Patients Xmatched/Assigned for a unit after editing and
  1. ; puts into AFTP() array. If total after editing < original total
  1. ; then the deleted patient Xmatched/Assigned node is built onto the
  1. ; audit trail. The input template then call line BLD3 to get the
  1. ; associated Blood Sample date/time multiple & include this on the
  1. ; audit trail also.
  1. S (PAT,AFTPAT)=0
  1. F S PAT=$O(^LRD(65,LRIEN,2,PAT)) Q:PAT'>0 S AFTPAT=AFTPAT+1,AFTP(PAT)=^LRD(65,LRIEN,2,PAT,0)
  1. I AFTPAT<BEGPAT D
  1. . S LRM=PNODE
  1. . S O=$P(LRM,U),Z="65.01,.01" D AUDIT
  1. . S O=$P(LRM,U,2),Z="65.01,.02" D AUDIT
  1. I AFTPAT<BEGPAT D BLD4
  1. Q
  1. ;
  1. BLD ; Gets all original blood samples for a patient, sets into the
  1. ; BEGB() array and counts total for later comparison
  1. S (BLD,BEGBLD)=0
  1. F S BLD=$O(^LRD(65,LRIEN,2,LRDFN,1,BLD)) Q:BLD'>0 S BEGBLD=BEGBLD+1,BEGB(BLD)=^LRD(65,LRIEN,2,LRDFN,1,BLD,0)
  1. Q
  1. ;
  1. BLD1 ; Gets patient blood samples after editing, set into AFTB() array,
  1. ; counts total. If total after editing < original total, then the
  1. ; deleted node is built onto the audit trail.
  1. S (BLD,AFTBLD)=0
  1. F S BLD=$O(^LRD(65,LRIEN,2,LRDFN,1,BLD)) Q:BLD'>0 S AFTBLD=AFTBLD+1,AFTB(BLD)=^LRD(65,LRIEN,2,LRDFN,1,BLD,0)
  1. Q:'$D(BEGBLD) I AFTBLD<BEGBLD D BLD2 Q
  1. Q
  1. BLD2 ; Actual code that puts the Blood Sample Date/Time subfields
  1. ; into the audit trail.
  1. S LRM=BNODE
  1. S O=$P(LRM,U),Z="65.02,.01" D AUDIT
  1. S O=$P(LRM,U,2),Z="65.02,.02" D AUDIT
  1. S O=$P(LRM,U,3),Z="65.02,.03" D AUDIT
  1. S O=$P(LRM,U,4),Z="65.02,.04" D AUDIT
  1. S O=$P(LRM,U,5),Z="65.02,.05" D AUDIT
  1. S O=$P(LRM,U,7),Z="65.02,.07" D AUDIT
  1. S O=$P(LRM,U,8),Z="65.02,.08" D AUDIT
  1. S O=$P(LRM,U,9),Z="65.02,.09" D AUDIT
  1. S O=$P(LRM,U,10),Z="65.02,.1" D AUDIT
  1. Q
  1. ;
  1. BLD3 ; Gets all Blood Sample date/time assigned to a particular
  1. ; LRDFN, sets into BEGB1() array, counts total. This is so
  1. ; that the audit trail is built for this submultiple node
  1. ; in the case that the entire Patient Xmatched/Assigned node
  1. ; is deleted.
  1. S (BLD1,BEGBLD1)=0
  1. F S BLD1=$O(^LRD(65,LRIEN,2,LRDFN,1,BLD1)) Q:BLD1'>0 S BEGB1(BLD1)=^LRD(65,LRIEN,2,LRDFN,1,BLD1,0),BEGBLD1=BEGBLD1+1
  1. Q
  1. ;
  1. BLD4 ; If a Patients Xmatched/Assigned entry has been deleted, adds
  1. ; adds any Blood Sample Date/time entries for that deleted
  1. ; patient to the audit trail.
  1. I '$D(BEGB1) Q
  1. F BLD1=0:0 S BLD1=$O(BEGB1(BLD1)) Q:'BLD1 S BNODE=BEGB1(BLD1) D BLD2
  1. Q
  1. ;
  1. AUDIT I O]"" S X="Deleted" D EN^LRUD
  1. Q
  1. ;
  1. K ; Kills variables created during editing of a disposition
  1. K LRDISP,LRDSP,LRDIST,LRPERS,LRPTRANS,LRDIPD,LRPTR,LRPHYS,LRTS,LRREC,LRREACT,LRPROVN,LRTSNUM,LRRXTYPE,LRPTREC,LRTRDT,LRCOMP,LRCOMPID,LRENTP,LRUNABO,LRUNRH,LRPOOL,LRRECRX,LROLD,LRVOL,LRTYPE
  1. Q
  1. ;
  1. CHECK I O'=X D EN^LRUD
  1. Q