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

RORRP036.m

Go to the documentation of this file.
  1. RORRP036 ;HCIOFO/SG - RPC: HEPC PATIENT LOAD ; 10/27/05 2:39pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  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: [RORHEPC 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. LOAD(RESULTS,REGIEN,PATIEN,LOCK) ;
  1. N HEPCBUF,I,IENS,LOCKRC,RC,RESPTR,RORBUF,RORERRDL,RORLOCK,RORMSG,TMP
  1. D CLEAR^RORERR("LOAD^RORRP036",1)
  1. K RESULTS S RESULTS=$$ALLOC^RORTMP()
  1. S HEPCBUF="HEPC",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 record
  1. I $G(LOCK),IENS>0 D I LOCKRC<0 D ERROR(.RESULTS,+LOCKRC) Q
  1. . S LOCKRC=$$LOCK^RORLOCK(798,IENS)
  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 HepC data
  1. I IENS>0 S RC=0 D I RC<0 D ERROR(.RESULTS,RC) Q
  1. . Q:$D(^RORDATA(798,+IENS))<10
  1. . ; Insert code here if/when necessary
  1. ;
  1. ;===
  1. S RESPTR=RESPTR+1,@RESULTS@(RESPTR)=HEPCBUF
  1. S @RESULTS@(0)=LOCKRC
  1. Q