source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORUPD07.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: 2.4 KB
Line 
1RORUPD07 ;HCIOFO/SG - PROCESSING OF THE 'PROBLEM' FILE ; 8/3/05 9:46am
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; This routine uses the following IAs:
5 ;
6 ; #928 ACTIVE^GMPLUTL
7 ; #2977 GETFLDS^GMPLEDT3
8 ;
9 Q
10 ;
11 ;***** LOADS DATA ELEMENT VALUES
12 ;
13 ; IENS IENS of the current record
14 ;
15 ; Return values:
16 ; <0 Error code
17 ; 0 Ok
18 ;
19LOAD(IENS) ;
20 N RC S RC=0
21 ;--- API #1
22 I $D(RORUPD("SR",RORFILE,"F",1)) D Q:RC<0 RC
23 . S RC=$$LOADFLDS^RORUPDUT(RORFILE,IENS)
24 ;--- API #2
25 I $D(RORUPD("SR",RORFILE,"F",2)) D Q:RC<0 RC
26 . N DE,GMPFLD,GMPORIG,GMPROV,GMVAMC,IN,IP,VT
27 . S (GMPVAMC,GMPROV)=0
28 . D GETFLDS^GMPLEDT3(+IENS)
29 . ;---
30 . S DE=""
31 . F S DE=$O(RORUPD("SR",RORFILE,"F",2,DE)) Q:DE="" D
32 . . S VT=""
33 . . F S VT=$O(RORUPD("SR",RORFILE,"F",2,DE,VT)) Q:VT="" D
34 . . . S IP=+$P(RORUPD("SR",RORFILE,"F",2,DE,VT),U,1) Q:IP'>0
35 . . . S IN=+$P(RORUPD("SR",RORFILE,"F",2,DE,VT),U,2)
36 . . . S RORVALS("DV",RORFILE,DE,VT)=$P($G(GMPFLD(IN)),U,IP)
37 Q 0
38 ;
39 ;***** PROCESSING OF THE 'PROBLEM' FILE
40 ;
41 ; UPDSTART Date of the earliest update
42 ; PATIEN Patient IEN
43 ;
44 ; Return values:
45 ; <0 Error code
46 ; 0 Continue processing of the current patient
47 ; 1 Stop processing
48 ;
49PROBLEM(UPDSTART,PATIEN) ;
50 N RORFILE ; File number
51 N RORPLST ; List of patient problems
52 ;
53 N DATE,IS,LOCATION,PROBIENS,RC,TMP
54 S RORFILE=9000011
55 ;--- Check if the problem list has been modified in
56 ; the data scan period of the patient.
57 Q:$$MOD^GMPLUTL3(PATIEN)<UPDSTART 0
58 ;--- Load a list of active problems
59 D ACTIVE^GMPLUTL(PATIEN,.RORPLST)
60 ;
61 ;--- Browse through the problems
62 S (IS,RC)=0
63 F S IS=$O(RORPLST(IS)) Q:IS="" D Q:RC
64 . S PROBIENS=+RORPLST(IS,0)_","
65 . ;--- Load necessary data elements
66 . I $D(RORUPD("SR",RORFILE,"F"))>1 D I TMP<0 D INCEC^RORUPDUT() Q
67 . . S TMP=$$LOAD(PROBIENS) Q:TMP<0
68 . . S TMP=$$GETDE^RORUPDUT(RORFILE,130)
69 . . S LOCATION=$S(TMP>0:$$IEN4^RORUTL18(TMP),1:"")
70 . ;--- Ignore problems entered not in the data scan period
71 . S DATE=$$GETDE^RORUPDUT(RORFILE,118)
72 . Q:(DATE<UPDSTART)!(DATE'<RORUPD("DSEND"))
73 . ;--- Apply "before" rules
74 . S RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"B",DATE,$G(LOCATION))
75 . I RC D INCEC^RORUPDUT(.RC) Q
76 . ;--- Apply "after" rules
77 . S RC=$$APLRULES^RORUPDUT(RORFILE,PROBIENS,"A",DATE,$G(LOCATION))
78 . I RC D INCEC^RORUPDUT(.RC) Q
79 ;
80 D CLRDES^RORUPDUT(RORFILE)
81 Q RC
Note: See TracBrowser for help on using the repository browser.