source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP030.m@ 1739

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

initial load of WorldVistAEHR

File size: 1.6 KB
RevLine 
[613]1RORRP030 ;HCIOFO/SG - RPC: PATIENT DELETE ; 11/29/05 3:04pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** MARKS THE PATIENT'S RECORD AS DELETED FROM THE REGISTRY
7 ; RPC: [ROR PATIENT DELETE]
8 ;
9 ; .RESULTS Reference to a local variable where the results
10 ; are returned to.
11 ;
12 ; REGIEN Registry IEN
13 ;
14 ; RORDFN IEN of the patient
15 ;
16 ; [FORCE] Deprecated
17 ;
18 ; Return Values:
19 ;
20 ; A negative value of the first "^"-piece of the RESULTS(0)
21 ; indicates an error (see the RPCSTK^RORERR procedure for more
22 ; details).
23 ;
24 ; Otherwise, the following codes can be returned in the RESULTS(0):
25 ;
26 ; 0 The record cannot be deleted
27 ; 9 The record has been marked as deleted
28 ;
29DELETE(RESULTS,REGIEN,RORDFN,FORCE) ;
30 N IENS,RC,REGNAME,RORFDA,RORMSG,TMP
31 D CLEAR^RORERR("DELETE^RORRP030",1)
32 K RESULTS S RESULTS(0)=0
33 ;
34 ;--- Get the registry description/name
35 S TMP=$$REGNAME^RORUTL01(REGIEN)
36 I TMP="" D D RPCSTK^RORERR(.RESULTS,RC) Q
37 . S RC=$$ERROR^RORERR(-1,,,RORDFN)
38 S REGNAME=$S($P(TMP,U,2)'="":$P(TMP,U,2),1:$P(TMP,U))
39 ;
40 ;--- Get IENS of the registry record
41 S IENS=$$PRRIEN^RORUTL01(RORDFN,REGIEN)_","
42 I IENS'>0 D D RPCSTK^RORERR(.RESULTS,RC) Q
43 . S RC=$$ERROR^RORERR(-97,,,RORDFN,REGNAME)
44 ;
45 I $$PENDING^RORUTL18(+IENS) D
46 . ;--- Delete the pending record immediately
47 . N DA,DIK S DIK=$$ROOT^DILFD(798),DA=+IENS D ^DIK
48 E D
49 . ;--- Mark the record as deleted
50 . S RORFDA(798,IENS,3)=5
51 . D FILE^DIE(,"RORFDA","RORMSG")
52 . I $G(DIERR) D D RPCSTK^RORERR(.RESULTS,RC)
53 . . S RC=$$DBS^RORERR("RORMSG",-9,,RORDFN,798,IENS)
54 ;---
55 S RESULTS(0)=9
56 Q
Note: See TracBrowser for help on using the repository browser.