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

RORUPD62.m

Go to the documentation of this file.
  1. RORUPD62 ;HCIOFO/SG - HIV-SPECIFIC REGISTRY UPDATE CODE ; 5/11/05 2:17pm
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. ; This routine uses the following IAs:
  1. ;
  1. ; #2762 Check for the patient merge (controlled)
  1. ;
  1. ;--------------------------------------------------------------------
  1. ; Registry: [VA HIV]
  1. ;--------------------------------------------------------------------
  1. Q
  1. ;
  1. ;***** CONVERTS ICR 2.1 RECORDS TO CCR:HIV FORMAT
  1. ;
  1. ; RORREG Registry IEN
  1. ;
  1. ; Return Values:
  1. ; <0 Error Code
  1. ; 0 Ok
  1. ;
  1. CONVERT(RORREG) ;
  1. N CODE,IMRIEN,PATIEN,RC,REGIEN,RULENAME,RULES,TMP
  1. D LOG^RORLOG(2,"ICR 2.1 Conversion")
  1. S REGIEN=+RORREG
  1. ;--- Prepare the selection rules
  1. S RULENAME="VA HIV 2.1 CONVERSION"
  1. S TMP=$$SRLIEN^RORUTL02(RULENAME)
  1. Q:TMP'>0 $$ERROR^RORERR(-3,,RULENAME)
  1. S RULES(1)=TMP_U_DT
  1. ;--- Convert the remaining records of ICR v2.1
  1. S (IMRIEN,RC)=0
  1. F S IMRIEN=$O(^IMR(158,IMRIEN)) Q:IMRIEN'>0 D Q:RC<0
  1. . S CODE=$P($G(^IMR(158,IMRIEN,0)),U) Q:CODE'>0
  1. . S PATIEN=+$$XOR^RORUTL03(CODE) Q:PATIEN'>0
  1. . ;--- Check if the patient has been merged
  1. . S TMP=+$G(^DPT(PATIEN,-9)) S:TMP>0 PATIEN=TMP
  1. . ;--- Check if the patient record in the file #2 is valid
  1. . Q:$$CHKPTR^RORUTL05(PATIEN)<0
  1. . ;--- Quit if the patient has already been added to the new registry
  1. . Q:$$PRRIEN^RORUTL01(PATIEN,REGIEN)>0
  1. . ;--- Check if the patient is an employee
  1. . Q:$$SKIPEMPL^RORUTL02(PATIEN,.REGIEN)
  1. . ;--- Add the patient to the new registry
  1. . S TMP=$$ADDPAT^RORUPD06(PATIEN,"VA HIV",.RULES)
  1. ;---
  1. Q $S(RC<0:RC,1:0)
  1. ;
  1. ;***** AFTER UPDATE CALL-BACK ENTRY POINT
  1. ;
  1. ; RORIEN An IEN of the newly added registry record
  1. ; PATIEN Patient IEN
  1. ; REGIEN Registry IEN
  1. ;
  1. ; Return Values:
  1. ; <0 Error Code
  1. ; 0 Ok
  1. ;
  1. POSTUPD(RORIEN,PATIEN,REGIEN) ;
  1. N DA,DIK,IENS,RC,RORFDA,RORHIV,RORMSG
  1. S RORIEN=+$G(RORIEN) Q:RORIEN'>0 0
  1. ;--- Delete the record if it exists by some reason
  1. D:$D(^RORDATA(799.4,RORIEN))
  1. . S DIK="^RORDATA(799.4,",DA=RORIEN D ^DIK
  1. ;--- Prepare the data
  1. S IENS="+1,"
  1. S RORFDA(799.4,IENS,.01)=RORIEN
  1. S RORHIV(1)=RORIEN
  1. ;--- Add the record to the ROR HIV STUDY file
  1. D UPDATE^DIE(,"RORFDA","RORHIV","RORMSG")
  1. Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,799.4,IENS)
  1. Q 0