source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP036.m

Last change on this file was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1RORRP036 ;HCIOFO/SG - RPC: HEPC PATIENT LOAD ; 10/27/05 2:39pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** PROCESSES THE ERROR(S) AND UNLOCKS THE RECORDS
7ERROR(RESULTS,RC) ;
8 D RPCSTK^RORERR(.RESULTS,RC)
9 D UNLOCK^RORLOCK(.RORLOCK)
10 Q
11 ;
12 ;***** LOADS THE PATIENT'S DATA FOR EDITING
13 ; RPC: [RORHEPC PATIENT LOAD]
14 ;
15 ; .RESULTS Reference to a local variable where the results
16 ; are returned to.
17 ;
18 ; REGIEN Registry IEN
19 ;
20 ; PATIEN IEN of the registry patient (DFN)
21 ;
22 ; [LOCK] Lock the registry record before loading the data and
23 ; leave it locked.
24 ;
25 ; Return Values:
26 ;
27 ; A negative value of the first "^"-piece of the RESULTS(0)
28 ; indicates an error (see the RPCSTK^RORERR procedure for more
29 ; details).
30 ;
31 ; If locking was requested (see the LOCK parameter) and the record
32 ; could not be locked then the first "^"-piece of the @RESULTS@(0)
33 ; would be greater than 0. The @RESULTS@(0) would contain the lock
34 ; descriptor and subsequent nodes of the global array would contain
35 ; the data (see below). The lock descriptor contains information
36 ; about the process, which owns the most recent lock of the record.
37 ; The "O" flag (read-only) would also be added to the 15th field
38 ; of the "PRD" segment.
39 ;
40 ; @RESULTS@(0) Lock Descriptor
41 ; ^01: Date/Time (FileMan)
42 ; ^02: User/Process name
43 ; ^03: User IEN (DUZ)
44 ; ^04: $JOB
45 ; ^05: Task number
46 ;
47 ; THE DATA IS LOADED ONLY FOR VIEWING PURPOSES (READ-ONLY)!
48 ;
49 ; Otherwise, zero is returned in the @RESULTS@(0) and the
50 ; subsequent nodes of the global array contain the patient's data.
51 ;
52 ; @RESULTS@(0) 0
53 ;
54 ; @RESULTS@(i) Demographic data
55 ; ^01: "DEM"
56 ; ^02: ""
57 ; ... See description of the ROR PATIENT
58 ; GET DATA remote procedure
59 ;
60 ; @RESULTS@(i) Basic registry data
61 ; ^01: "PRD"
62 ; ^02: ""
63 ; ... See description of the ROR PATIENT
64 ; GET DATA remote procedure
65 ;
66 ; RESULTS(i) Local field data
67 ; ^O1: "LFV"
68 ; ... See description of the ROR PATIENT
69 ; GET DATA remote procedure
70 ;
71 ; RESULTS(i) Selection Rule
72 ; ^01: "PSR"
73 ; ... See description of the ROR PATIENT
74 ; GET DATA remote procedure
75 ;
76LOAD(RESULTS,REGIEN,PATIEN,LOCK) ;
77 N HEPCBUF,I,IENS,LOCKRC,RC,RESPTR,RORBUF,RORERRDL,RORLOCK,RORMSG,TMP
78 D CLEAR^RORERR("LOAD^RORRP036",1)
79 K RESULTS S RESULTS=$$ALLOC^RORTMP()
80 S HEPCBUF="HEPC",LOCKRC=0
81 ;=== Check the parameters
82 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
83 . ;--- Registry IEN
84 . I $G(REGIEN)'>0 D Q
85 . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
86 . S REGIEN=+REGIEN
87 . ;--- Patient IEN
88 . I $G(PATIEN)'>0 D Q
89 . . S RC=$$ERROR^RORERR(-88,,,,"PATIEN",$G(PATIEN))
90 . S PATIEN=+PATIEN
91 ;
92 ;=== Get the IENS of the registry record
93 S IENS=$$PRRIEN^RORUTL01(PATIEN,REGIEN)_","
94 ;
95 ;=== Lock the record
96 I $G(LOCK),IENS>0 D I LOCKRC<0 D ERROR(.RESULTS,+LOCKRC) Q
97 . S LOCKRC=$$LOCK^RORLOCK(798,IENS)
98 ;
99 ;=== Get the patient's data
100 D GETPTDAT^RORRP021(.RORBUF,PATIEN,"LS",REGIEN)
101 I $G(RORBUF(0))<0 D ERROR(.RESULTS,+RORBUF(0)) Q
102 ;---
103 S I=""
104 F S I=$O(RORBUF(I)) Q:I="" Q:$P(RORBUF(I),U)="PRD"
105 D:I'=""
106 . S TMP=$P(RORBUF(I),U,15)
107 . I TMP'["O" S:LOCKRC $P(RORBUF(I),U,15)=TMP_"O" ; Read Only
108 . E D UNLOCK^RORLOCK(.RORLOCK) S LOCKRC=0
109 ;---
110 M @RESULTS=RORBUF S RESPTR=$O(RORBUF(""),-1)
111 K RORBUF
112 ;
113 ;=== Load the HepC data
114 I IENS>0 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
115 . Q:$D(^RORDATA(798,+IENS))<10
116 . ; Insert code here if/when necessary
117 ;
118 ;===
119 S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=HEPCBUF
120 S @RESULTS@(0)=LOCKRC
121 Q
Note: See TracBrowser for help on using the repository browser.