source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP033.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 4.9 KB
Line 
1RORRP033 ;HCIOFO/SG - RPC: HIV PATIENT LOAD ; 10/27/05 2:12pm
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: [RORICR 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 ;
76 ; @RESULTS@(i) Patient's history (risk factors)
77 ; ^01: "PH"
78 ; ^02: ""
79 ; ... See description of the RORICR
80 ; CDC LOAD remote procedure
81 ;
82 ; @RESULTS@(i) Registry data
83 ; ^01: "ICR"
84 ; ^02: ""
85 ; ^03: Clinical AIDS (0/1)
86 ; ^04: Date of Clinical AIDS (FileMan)
87 ; ^05: reserved
88 ;
89LOAD(RESULTS,REGIEN,PATIEN,LOCK) ;
90 N I,ICRBUF,IENS,LOCKRC,RC,RESPTR,RORBUF,RORERRDL,RORLOCK,RORMSG,TMP
91 D CLEAR^RORERR("LOAD^RORRP033",1)
92 K RESULTS S RESULTS=$$ALLOC^RORTMP()
93 S ICRBUF="ICR",LOCKRC=0
94 ;=== Check the parameters
95 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
96 . ;--- Registry IEN
97 . I $G(REGIEN)'>0 D Q
98 . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
99 . S REGIEN=+REGIEN
100 . ;--- Patient IEN
101 . I $G(PATIEN)'>0 D Q
102 . . S RC=$$ERROR^RORERR(-88,,,,"PATIEN",$G(PATIEN))
103 . S PATIEN=+PATIEN
104 ;
105 ;=== Get the IENS of the registry record
106 S IENS=$$PRRIEN^RORUTL01(PATIEN,REGIEN)_","
107 ;
108 ;=== Lock the records
109 I $G(LOCK),IENS>0 D I LOCKRC<0 D ERROR(.RESULTS,+LOCKRC) Q
110 . S RORLOCK(798,IENS)=""
111 . S RORLOCK(799.4,IENS)=""
112 . S LOCKRC=$$LOCK^RORLOCK(.RORLOCK)
113 ;
114 ;=== Get the patient's data
115 D GETPTDAT^RORRP021(.RORBUF,PATIEN,"LS",REGIEN)
116 I $G(RORBUF(0))<0 D ERROR(.RESULTS,+RORBUF(0)) Q
117 ;---
118 S I=""
119 F S I=$O(RORBUF(I)) Q:I="" Q:$P(RORBUF(I),U)="PRD"
120 D:I'=""
121 . S TMP=$P(RORBUF(I),U,15)
122 . I TMP'["O" S:LOCKRC $P(RORBUF(I),U,15)=TMP_"O" ; Read Only
123 . E D UNLOCK^RORLOCK(.RORLOCK) S LOCKRC=0
124 ;---
125 M @RESULTS=RORBUF S RESPTR=$O(RORBUF(""),-1)
126 K RORBUF
127 ;
128 ;=== Load the ICR data
129 I IENS>0 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
130 . Q:$D(^RORDATA(799.4,+IENS))<10
131 . ;--- Patient's history (risk factors)
132 . S RORBUF="PH"
133 . S RC=$$LOAD^RORRP026(IENS,"PH^RORRP026",.RORBUF) Q:RC<0
134 . S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=RORBUF
135 . ;--- Other registry data
136 . D GETS^DIQ(799.4,IENS,".02;.03;","I","RORBUF","RORMSG")
137 . I $G(DIERR) D Q
138 . . S RC=$$DBS^RORERR("RORMSG",-9,,PATIEN,799.4,IENS)
139 . S $P(ICRBUF,U,3)=+$G(RORBUF(799.4,IENS,.02,"I"))
140 . S $P(ICRBUF,U,4)=$G(RORBUF(799.4,IENS,.03,"I"))
141 ;
142 ;===
143 S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=ICRBUF
144 S @RESULTS@(0)=LOCKRC
145 Q
Note: See TracBrowser for help on using the repository browser.