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

RORRP033.m

Go to the documentation of this file.
  1. RORRP033 ;HCIOFO/SG - RPC: HIV PATIENT LOAD ;10/27/05 2:12pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;**14**;Feb 17, 2006;Build 24
  1. ;
  1. Q
  1. ;
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ; --- ROUTINE MODIFICATION LOG ---
  1. ;
  1. ;PKG/PATCH DATE DEVELOPER MODIFICATION
  1. ;----------- ---------- ----------- ----------------------------------------
  1. ;ROR*1.5*14 APR 2011 A SAUNDERS LOAD: Added AIDS DX - FIRST DIAGNOSED
  1. ; (#12.08) from file 799.4 to the ICR
  1. ; segment in the returned array
  1. ;******************************************************************************
  1. ;******************************************************************************
  1. ;***** PROCESSES THE ERROR(S) AND UNLOCKS THE RECORDS
  1. ERROR(RESULTS,RC) ;
  1. D RPCSTK^RORERR(.RESULTS,RC)
  1. D UNLOCK^RORLOCK(.RORLOCK)
  1. Q
  1. ;
  1. ;***** LOADS THE PATIENT'S DATA FOR EDITING
  1. ; RPC: [RORICR PATIENT LOAD]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; REGIEN Registry IEN
  1. ;
  1. ; PATIEN IEN of the registry patient (DFN)
  1. ;
  1. ; [LOCK] Lock the registry record before loading the data and
  1. ; leave it locked.
  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. ; If locking was requested (see the LOCK parameter) and the record
  1. ; could not be locked then the first "^"-piece of the @RESULTS@(0)
  1. ; would be greater than 0. The @RESULTS@(0) would contain the lock
  1. ; descriptor and subsequent nodes of the global array would contain
  1. ; the data (see below). The lock descriptor contains information
  1. ; about the process, which owns the most recent lock of the record.
  1. ; The "O" flag (read-only) would also be added to the 15th field
  1. ; of the "PRD" segment.
  1. ;
  1. ; @RESULTS@(0) Lock Descriptor
  1. ; ^01: Date/Time (FileMan)
  1. ; ^02: User/Process name
  1. ; ^03: User IEN (DUZ)
  1. ; ^04: $JOB
  1. ; ^05: Task number
  1. ;
  1. ; THE DATA IS LOADED ONLY FOR VIEWING PURPOSES (READ-ONLY)!
  1. ;
  1. ; Otherwise, zero is returned in the @RESULTS@(0) and the
  1. ; subsequent nodes of the global array contain the patient's data.
  1. ;
  1. ; @RESULTS@(0) 0
  1. ;
  1. ; @RESULTS@(i) Demographic data
  1. ; ^01: "DEM"
  1. ; ^02: ""
  1. ; ... See description of the ROR PATIENT
  1. ; GET DATA remote procedure
  1. ;
  1. ; @RESULTS@(i) Basic registry data
  1. ; ^01: "PRD"
  1. ; ^02: ""
  1. ; ... See description of the ROR PATIENT
  1. ; GET DATA remote procedure
  1. ;
  1. ; RESULTS(i) Local field data
  1. ; ^O1: "LFV"
  1. ; ... See description of the ROR PATIENT
  1. ; GET DATA remote procedure
  1. ;
  1. ; RESULTS(i) Selection Rule
  1. ; ^01: "PSR"
  1. ; ... See description of the ROR PATIENT
  1. ; GET DATA remote procedure
  1. ;
  1. ; @RESULTS@(i) Patient's history (risk factors)
  1. ; ^01: "PH"
  1. ; ^02: ""
  1. ; ... See description of the RORICR
  1. ; CDC LOAD remote procedure
  1. ;
  1. ; @RESULTS@(i) Registry data
  1. ; ^01: "ICR"
  1. ; ^02: ""
  1. ; ^03: Clinical AIDS (null/0/1/9)
  1. ; ^04: Date of Clinical AIDS (FileMan)
  1. ; ^05: reserved
  1. ; ^06: HIV first DX at this facility (null,0/1/9)
  1. ;
  1. LOAD(RESULTS,REGIEN,PATIEN,LOCK) ;
  1. N I,ICRBUF,IENS,LOCKRC,RC,RESPTR,RORBUF,RORERRDL,RORLOCK,RORMSG,TMP
  1. D CLEAR^RORERR("LOAD^RORRP033",1)
  1. K RESULTS S RESULTS=$$ALLOC^RORTMP()
  1. S ICRBUF="ICR",LOCKRC=0
  1. ;=== Check the parameters
  1. S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
  1. . ;--- Registry IEN
  1. . I $G(REGIEN)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
  1. . S REGIEN=+REGIEN
  1. . ;--- Patient IEN
  1. . I $G(PATIEN)'>0 D Q
  1. . . S RC=$$ERROR^RORERR(-88,,,,"PATIEN",$G(PATIEN))
  1. . S PATIEN=+PATIEN
  1. ;
  1. ;=== Get the IENS of the registry record
  1. S IENS=$$PRRIEN^RORUTL01(PATIEN,REGIEN)_","
  1. ;
  1. ;=== Lock the records
  1. I $G(LOCK),IENS>0 D I LOCKRC<0 D ERROR(.RESULTS,+LOCKRC) Q
  1. . S RORLOCK(798,IENS)=""
  1. . S RORLOCK(799.4,IENS)=""
  1. . S LOCKRC=$$LOCK^RORLOCK(.RORLOCK)
  1. ;
  1. ;=== Get the patient's data
  1. D GETPTDAT^RORRP021(.RORBUF,PATIEN,"LS",REGIEN)
  1. I $G(RORBUF(0))<0 D ERROR(.RESULTS,+RORBUF(0)) Q
  1. ;---
  1. S I=""
  1. F S I=$O(RORBUF(I)) Q:I="" Q:$P(RORBUF(I),U)="PRD"
  1. D:I'=""
  1. . S TMP=$P(RORBUF(I),U,15)
  1. . I TMP'["O" S:LOCKRC $P(RORBUF(I),U,15)=TMP_"O" ; Read Only
  1. . E D UNLOCK^RORLOCK(.RORLOCK) S LOCKRC=0
  1. ;---
  1. M @RESULTS=RORBUF S RESPTR=$O(RORBUF(""),-1)
  1. K RORBUF
  1. ;
  1. ;=== Load the ICR data
  1. I IENS>0 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
  1. . Q:$D(^RORDATA(799.4,+IENS))<10
  1. . ;--- Patient's history (risk factors)
  1. . S RORBUF="PH"
  1. . S RC=$$LOAD^RORRP026(IENS,"PH^RORRP026",.RORBUF) Q:RC<0
  1. . S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=RORBUF
  1. . ;--- Other registry data
  1. . D GETS^DIQ(799.4,IENS,".02;.03;12.08","I","RORBUF","RORMSG")
  1. . I $G(DIERR) D Q
  1. . . S RC=$$DBS^RORERR("RORMSG",-9,,PATIEN,799.4,IENS)
  1. . S $P(ICRBUF,U,3)=$G(RORBUF(799.4,IENS,.02,"I")) ;send actual value
  1. . S $P(ICRBUF,U,4)=$G(RORBUF(799.4,IENS,.03,"I"))
  1. . S $P(ICRBUF,U,6)=$G(RORBUF(799.4,IENS,12.08,"I")) ;HIV first Diagnosed at this Facility?
  1. ;
  1. ;===
  1. S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=ICRBUF
  1. S @RESULTS@(0)=LOCKRC
  1. Q