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

RORRP030.m

Go to the documentation of this file.
  1. RORRP030 ;HCIOFO/SG - RPC: PATIENT DELETE ;11/29/05 3:04pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;**10,18**;Feb 17, 2006;Build 25
  1. ;*************************************************************************
  1. ; --- ROUTINE MODIFICATION LOG ---
  1. ;
  1. ;PKG/PATCH DATE DEVELOPER MODIFICATION
  1. ;----------- ---------- ----------- ----------------------------------------
  1. ;ROR*1.5*18 APR 2012 C RAY Added logic to immediately delete
  1. ; patients in auto confirm registries
  1. ; Deletion is logged
  1. ;***********************************************************************
  1. ; This routine uses the following IAs:
  1. ;
  1. ; #2053 FILE^DIE (supported)
  1. Q
  1. ;
  1. ;***** MARKS THE PATIENT'S RECORD AS DELETED FROM THE REGISTRY
  1. ; RPC: [ROR PATIENT DELETE]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; RORDFN IEN of the patient
  1. ;
  1. ; [FORCE] Deprecated
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0)
  1. ; indicates an error (see the RPCSTK^RORERR procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, the following codes can be returned in the RESULTS(0):
  1. ;
  1. ; 0 The record cannot be deleted
  1. ; 9 The record has been marked as deleted
  1. ;
  1. DELETE(RESULTS,REGIEN,RORDFN,FORCE) ;
  1. N IENS,RC,REGNAME,RORFDA,RORMSG,TMP,DIERR,RORPARM,REGLST
  1. D CLEAR^RORERR("DELETE^RORRP030",1)
  1. K RESULTS S RESULTS(0)=0
  1. ;
  1. ;--- Get the registry description/name
  1. S TMP=$$REGNAME^RORUTL01(REGIEN)
  1. I TMP="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-1,,,RORDFN)
  1. S REGNAME=$S($P(TMP,U,2)'="":$P(TMP,U,2),1:$P(TMP,U))
  1. ;
  1. ;--- Get IENS of the registry record
  1. S IENS=$$PRRIEN^RORUTL01(RORDFN,REGIEN)_","
  1. I IENS'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-97,,,RORDFN,REGNAME)
  1. ;--- non-CCR registries delete immediately and log -- Patch 18
  1. I $D(^ROR(798.1,"C",1,REGIEN)) D S RESULTS(0)=9 Q
  1. . S RORPARM("LOG")=1
  1. . S REGLST(REGNAME)=REGIEN
  1. . S RC=$$OPEN^RORLOG(.REGLST,,"PATIENT DELETION")
  1. . D LOG^RORERR(-90,,RORDFN,$G(REGNAME))
  1. . N DA,DIK S DIK=$$ROOT^DILFD(798),DA=+IENS D ^DIK
  1. . D CLOSE^RORLOG()
  1. ;
  1. ;-- CCR registries mark as deleted
  1. ;Patch 10: mark any deleted record as deleted (don't delete pending record immediately)
  1. D
  1. . ;--- Mark the record as deleted
  1. . S RORFDA(798,IENS,3)=5
  1. . D FILE^DIE(,"RORFDA","RORMSG")
  1. . I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC)
  1. . . S RC=$$DBS^RORERR("RORMSG",-9,,RORDFN,798,IENS)
  1. ;---
  1. S RESULTS(0)=9
  1. Q