source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORUPD62.m@ 1240

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1RORUPD62 ;HCIOFO/SG - HIV-SPECIFIC REGISTRY UPDATE CODE ; 5/11/05 2:17pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; This routine uses the following IAs:
5 ;
6 ; #2762 Check for the patient merge (controlled)
7 ;
8 ;--------------------------------------------------------------------
9 ; Registry: [VA HIV]
10 ;--------------------------------------------------------------------
11 Q
12 ;
13 ;***** CONVERTS ICR 2.1 RECORDS TO CCR:HIV FORMAT
14 ;
15 ; RORREG Registry IEN
16 ;
17 ; Return Values:
18 ; <0 Error Code
19 ; 0 Ok
20 ;
21CONVERT(RORREG) ;
22 N CODE,IMRIEN,PATIEN,RC,REGIEN,RULENAME,RULES,TMP
23 D LOG^RORLOG(2,"ICR 2.1 Conversion")
24 S REGIEN=+RORREG
25 ;--- Prepare the selection rules
26 S RULENAME="VA HIV 2.1 CONVERSION"
27 S TMP=$$SRLIEN^RORUTL02(RULENAME)
28 Q:TMP'>0 $$ERROR^RORERR(-3,,RULENAME)
29 S RULES(1)=TMP_U_DT
30 ;--- Convert the remaining records of ICR v2.1
31 S (IMRIEN,RC)=0
32 F S IMRIEN=$O(^IMR(158,IMRIEN)) Q:IMRIEN'>0 D Q:RC<0
33 . S CODE=$P($G(^IMR(158,IMRIEN,0)),U) Q:CODE'>0
34 . S PATIEN=+$$XOR^RORUTL03(CODE) Q:PATIEN'>0
35 . ;--- Check if the patient has been merged
36 . S TMP=+$G(^DPT(PATIEN,-9)) S:TMP>0 PATIEN=TMP
37 . ;--- Check if the patient record in the file #2 is valid
38 . Q:$$CHKPTR^RORUTL05(PATIEN)<0
39 . ;--- Quit if the patient has already been added to the new registry
40 . Q:$$PRRIEN^RORUTL01(PATIEN,REGIEN)>0
41 . ;--- Check if the patient is an employee
42 . Q:$$SKIPEMPL^RORUTL02(PATIEN,.REGIEN)
43 . ;--- Add the patient to the new registry
44 . S TMP=$$ADDPAT^RORUPD06(PATIEN,"VA HIV",.RULES)
45 ;---
46 Q $S(RC<0:RC,1:0)
47 ;
48 ;***** AFTER UPDATE CALL-BACK ENTRY POINT
49 ;
50 ; RORIEN An IEN of the newly added registry record
51 ; PATIEN Patient IEN
52 ; REGIEN Registry IEN
53 ;
54 ; Return Values:
55 ; <0 Error Code
56 ; 0 Ok
57 ;
58POSTUPD(RORIEN,PATIEN,REGIEN) ;
59 N DA,DIK,IENS,RC,RORFDA,RORHIV,RORMSG
60 S RORIEN=+$G(RORIEN) Q:RORIEN'>0 0
61 ;--- Delete the record if it exists by some reason
62 D:$D(^RORDATA(799.4,RORIEN))
63 . S DIK="^RORDATA(799.4,",DA=RORIEN D ^DIK
64 ;--- Prepare the data
65 S IENS="+1,"
66 S RORFDA(799.4,IENS,.01)=RORIEN
67 S RORHIV(1)=RORIEN
68 ;--- Add the record to the ROR HIV STUDY file
69 D UPDATE^DIE(,"RORFDA","RORHIV","RORMSG")
70 Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,799.4,IENS)
71 Q 0
Note: See TracBrowser for help on using the repository browser.